I have a pandas dataframe with such a timestamp:
This is: Tue Mar 16 2021 02:00:00 GMT+0000
However, when I convert it to datetime using this code:
df['time'] = pd.to_datetime(df['time'],utc=True).dt.tz_localize(None) df.set_index('time', inplace=True)
I get a timestamp of somewhen on the 1st of January 1970. I think, this is due to an incorrect unit. How can I amend my code to get the actual date?
df['time'] = pd.to_datetime(df['time'], unit='s')