Closed hpvaleriy closed 5 months ago
Hi, @hpvaleriy
This is because Date column is just index in pandas DataFrame. If you want to use Date as column, you need reset_index
method.
df.index
---------------------
DatetimeIndex(['2024-01-08', '2024-01-09', '2024-01-10', '2024-01-11',
'2024-01-12', '2024-01-16', '2024-01-17', '2024-01-18',
'2024-01-19', '2024-01-22', '2024-01-23', '2024-01-24',
'2024-01-25', '2024-01-26', '2024-01-29', '2024-01-30',
'2024-01-31', '2024-02-01', '2024-02-02', '2024-02-05',
'2024-02-06', '2024-02-07', '2024-02-08'],
dtype='datetime64[ns]', name='Date', freq=None)
Hope it will help you.
Hey @tiruka , yeah..my bad, thanks
Describe bug
For the last few days - there is no "Date" field in the DataFrame's columns
Simple code that reproduces your problem
`python import yfinance as yf
ticker = 'AAPL' yf.enable_debug_mode()
df = yf.download(tickers=ticker, start="2024-01-06", end="2024-02-09", interval='1d')
print(df.columns) `
Debug log
DEBUG Entering download() DEBUG Disabling multithreading because DEBUG logging enabled DEBUG Entering history() DEBUG Entering history() DEBUG AAPL: Yahoo GET parameters: {'period1': '2024-01-06 00:00:00-05:00', 'period2': '2024-02-09 00:00:00-05:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'} DEBUG Entering get() DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/AAPL DEBUG params=frozendict.frozendict({'period1': 1704517200, 'period2': 1707454800, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}) DEBUG Entering _get_cookie_and_crumb() DEBUG cookie_mode = 'basic' DEBUG Entering _get_cookie_and_crumb_basic() DEBUG loaded persistent cookie DEBUG reusing cookie DEBUG crumb = '7V6eV5qoHOu' DEBUG Exiting _get_cookie_and_crumb_basic() DEBUG Exiting _get_cookie_and_crumb() DEBUG response code=200 DEBUG Exiting get() DEBUG AAPL: yfinance received OHLC data: 2024-01-08 14:30:00 -> 2024-02-08 14:30:00 DEBUG AAPL: OHLC after cleaning: 2024-01-08 09:30:00-05:00 -> 2024-02-08 09:30:00-05:00 DEBUG AAPL: OHLC after combining events: 2024-01-08 00:00:00-05:00 -> 2024-02-08 00:00:00-05:00 DEBUG AAPL: yfinance returning OHLC: 2024-01-08 00:00:00-05:00 -> 2024-02-08 00:00:00-05:00 DEBUG Exiting history() DEBUG Exiting history() DEBUG Exiting download()
Bad data proof
No response
yfinance
version0.2.40
Python version
3.9.6
Operating system
MacOS Sonoma 14.4