I have this data which is unix epoch time

0     1554395425342
1     1554439920063
0     1554396216667
1     1554396391185
2     1554396391347
3     1554396400188
4     1554436938849
5     1554436938849
6     1554436938849
7     1554436938849
8     1554436938849
9     1554436938849
10    1554436938849
11    1554436938849
12    1554436938849
13    1554436938849
14    1554437680563
15    1554437680563
16    1554437680563
17    1554437680563
Name: time, dtype: int64

I have tried all the following tries to change it to normal date time

all_trades['time'] = pd.to_datetime(all_trades['time'], unit='s').dt.strftime('%Y-%m-%d')

and all_trades['time'] = pd.to_datetime(all_trades['time'].astype(int), unit='s')

failed -

OutOfBoundsDatetime: cannot convert input with unit 's'

all_trades['time'].apply(datetime.datetime.utcfromtimestamp)

failed -

ValueError: year 51226 is out of range

any other suggestion to try? thanks!

0 Answers