After using yfinance.download()
, I result in a pandas.DataFrame
object, that, when printed, outputs to this:
Date
2018-01-02 18700.199219 18700.199219 18700.199219 18700.199219 18700.199219 0
2018-01-03 18953.099609 18953.099609 18953.099609 18953.099609 18953.099609 0
2018-01-04 18922.500000 18922.500000 18922.500000 18922.500000 18922.500000 0
2018-01-05 18849.800781 18849.800781 18849.800781 18849.800781 18849.800781 0
2018-01-08 18911.900391 18911.900391 18911.900391 18911.900391 18911.900391 0
... ... ... ... ... ... ...
2022-03-04 23165.710938 23165.710938 23165.710938 23165.710938 23165.710938 0
2022-03-07 23148.070312 23148.070312 23148.070312 23148.070312 23148.070312 0
2022-03-08 23026.910156 23026.910156 23026.910156 23026.910156 23026.910156 0
2022-03-09 22659.669922 22659.669922 22659.669922 22659.669922 22659.669922 0
2022-03-10 22437.609375 22437.609375 22437.609375 22437.609375 22437.609375 0
[1061 rows x 6 columns]
I called it the UID since it is a unique identifier (I.e. special for each row) and it does not get classified as an column.
How do I access the data from the "Date" column?
CodePudding user response:
How do I access the data from the "Date" column?
Reset the index first, and convert the index to a regular column:
df.reset_index()['Date']