Dataframe is:
A
1641171600 1353
1641171900 1370
should be:
A
2022-08-17 23:01:40 1353
2022-08-19 23:01:40 1370
I'm trying to change all row's index columns to datetime format like: Y-m-d h:m:s
I have tried this code:
df.index = df.apply(lambda x: datetime.fromtimestamp(x))
I saw another same question but it was about changing to upper or lower case like:
df.index = df.index.map(str.lower())
But how to apply for datetime
instead of str.lower()
in map()
function !!!