bananagator
bananagator

Reputation: 581

Increase Sampling rate on time-series data with Pandas

I have accelerometer data with variable sampling rate. I am trying to increase it a constant sampling rate 50hz through interpolation.The problem with the timestamps is, it doesn't have milliseconds. enter image description here

How do i do it without losing the data i already have?

Upvotes: 1

Views: 1232

Answers (1)

rvd
rvd

Reputation: 568

You can first set the index as your datetime column using df.set_index('timestamp') and use df.resample(). The directive you want to pass into the resample function is L for milliseconds, but you can read more here. The resample function also lets you choose a number of interpolation modes.

Upvotes: 1

Related Questions