I have a data-frame df
with a head that looks like:
amount_1 ... factor
date ...
2014-04-21 931.550533 ... 100.0
2014-04-22 932.174195 ... 100.0
2014-04-23 946.622481 ... 100.0
2014-04-24 938.722707 ... 100.0
2014-04-25 949.325041 ... 100.0
I would like to take the index (date
) and create a list. I am using:
dates = df.index.map(pd.Timestamp.date).tolist()
which gives me an output:
[datetime.date(2014, 2, 21), datetime.date(2014, 2, 22), datetime.date(2014, 2, 23), datetime.date(2014, 2, 24), datetime.date(2014, 2, 25), .....]
However I would like the output to look like:
[2014-04-21,2014-04-22,2014-04-23,2014-04-24,2014-04-25,....]
How can I do this?