Pandas yahoo finance DataReader

后端 未结 8 729
温柔的废话
温柔的废话 2020-12-24 09:36

I am trying to get the Adj Close prices from Yahoo Finance into a DataFrame. I have all the stocks I want but I am not able to sort on date.

stocks = [\'ORCL         


        
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 10:04

    f is a Panel You can get a DataFrame and reset index (Date) using:

    f.loc['Adj Close',:,:].reset_index()
    

    but I'm not sure reset_index() is very useful as you can get Date using

    f.loc['Adj Close',:,:].index
    

    You might have a look at http://pandas.pydata.org/pandas-docs/stable/indexing.html#different-choices-for-indexing about indexing

提交回复
热议问题