I want to convert the DATE column values (5 integers (dtypes: int64) to datetime, however, after conversion all of my rows are 1970-01-01 with different hours/minutes/seconds.
The first three rows for the DATE column is shown below:
| DATE |
|---|
| 43390 |
| 43359 |
| 43531 |
I used
df['DATE'] = pd.to_datetime(df['DATE'],unit = 's')
and my results are the following:
| DATE |
|---|
| 1970-01-01 12:03:10 |
| 1970-01-01 12:02:39 |
| 1970-01-01 12:05:31 |
I want the conversion to show the actual date and time, not 1970-01-01 which clearly is not correct.
I also tried using
pd.to_datetime(df['DATE'], format='%Y%m%d') after applied df['DATE'] = pd.to_datetime(df['DATE'],unit = 's') but it gives me the same result.
If I apply pd.to_datetime(df['DATE'], format='%Y%m%d') to the original DATE with int64 dtypes, I got error
time data 43390 does not match format '%Y%m%d'
I am struggling to get the current datetime, any suggestions would be extremely grateful, thanks.