Hi I'm looking for someone with some experience to walk me through some questions I have regarding resampling (downsampling) in Python. Here is my problem: I have accelerometer data that comes in irregularly at 50Hz. Sometimes I get 50 samples a second, sometimes 1 every 3 seconds. I also get velocity data that comes in at 1Hz also fairly irregularly. My question is, how best to filter and align the data?


I have been using the pd.resample("1s").mean() and pd.resample("1s").last() methods to downsample/decimate my data. When using the .last() method I have been using a low pass filter with a cutoff of 0.5Hz prior to decimation. As far as I can tell, the .mean() acts as it's own low pass filter, but I'm not sure if this is correct as there should be a difference between using a moving average filter and then resampling vs resampling into 1 second bins and then taking the mean. I have seen in a lot of online dicussion people simple use pd.resample().mean() and that seems wrong to me.

Anyways, anyone with any insight would be greatly appreciated.

  • $\begingroup$ Are you able to time stamp the data; so even if irregular you know where in time each sample occurs. $\endgroup$ – Dan Boschen Dec 2 '19 at 20:02
  • $\begingroup$ Are you saying that the data comes to you at irregular intervals, or that it's actually sampled at irregular intervals? $\endgroup$ – TimWescott Dec 2 '19 at 20:04
  • $\begingroup$ The data is timestamped so I know when each time sample occurs. It's actually sampled at irregular intervals. $\endgroup$ – neezi Dec 2 '19 at 21:25
  • $\begingroup$ Anyone have any input or resources that would be helpful? $\endgroup$ – neezi Jan 10 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.