python - Pandas Dataframe resample -
i have quite huge dataframe, , need average on 15 second intervals. can see index not timestamp, need re-sample on column ts (timestamp). till have been using matplotlib.dates.num2date(table.index), quite time consuming, , gives me memory errors. there anyway use re-sample on , other column? if there faster way average every 15th second re-sample, please let me know. relevant code below.
import pandas pd import numpy np import matplotlib.dates pltd >>> table[ts] 735381.370833 2014-05-28 08:54:00 735381.379109 2014-05-28 09:05:55 735381.379155 2014-05-28 09:05:59 735381.380556 2014-05-28 09:08:00 735381.382014 2014-05-28 09:10:06 735381.407407 2014-05-28 09:46:40 table.index = pltd.num2date(table.index) table = table.resample('15s') table.index = pltd.date2num(table.index.to_pydatetime())
Comments
Post a Comment