Forum Discussion

db042190's avatar
db042190
Impactful Individual
3 years ago
Solved

python's yfinance returns data from command line but i dont even get a dataset in pbi

Hi , v-binbinyu shared this with us...   https://towardsdatascience.com/best-5-free-stock-market-apis-in-2019-ad91dddec984 .   I was able to list stock ticker MSFT history from my pc's command line...
  • db042190's avatar
    3 years ago

    i'm not sure if the history method can ever act in this capacity and i did see pbi alternatives that use web sources instead of python for this same purpose but this seems to work...i dont think dataset is a key word.  The last 2 statements apparently add columns to what the download method already offers.  I'll be looking up/for ways to make the download method show more tickers and the symbol itself rather than the hardcoded stock name.

     

    import yfinance as yf

    dataset=yf.download('MSFT','2010-01-01','2023-06-30')

    dataset["Date"]=dataset.index

    dataset["Stock"]="Microsoft"