Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

pandas.DataFrame – get the UID of each row?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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']
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading