python - downsampling data using timestamp information -


i have array of arbitrary data x , associated timestamps t correspond data in x (they same length n).

i want downsample data x smaller length m < n, such new data equally spaced in time (by using timestamp information). instead of decimating data taking every nth datapoint. using closest time-neighbor fine.

scipy has resampling code, tries interpolate between data points, cannot data. numpy or scipy have code this?

for example, suppose want downsample letters of alphabet according logarithmic time:

import string import numpy np x = string.lowercase[::] t = np.logspace(1, 10, num=26) y = downsample(x, t, 8) 

i'd suggest using pandas, resample function:

convenience method frequency conversion , resampling of regular time-series data.

note how parameter in particular.

you can convert numpy array dataframe:

import pandas pd yourpandasdf = pd.dataframe(yournumpyarray) 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -