ganesh reddy
ganesh reddy

Reputation: 1892

Pandas timeseries specifying time unit

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?

Upvotes: 0

Views: 793

Answers (1)

U2EF1
U2EF1

Reputation: 13279

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.

Upvotes: 1

Related Questions