Question

I have an uneven timestamped data that I would like to process in Pandas. The timestamps are in milliseconds starting at 0, So the data looks like

Timestamp        Property
0                   1
1                   2           
2                   3
4                   4
10                  4
19                  7

I have a very basic question, I can create a pd.Series object with index as the Timestamp. But how does Pandas know that my timestamps are in millis or for that matter in secs or hours?

Was it helpful?

Solution

Pandas assumes timestamps are in nanos, if you want to convert a column in millis, use df['col'] = df['col'].astype('datetime64[ms]'). Note that the final column will be in nanos.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top