定期的に測定された値のセットが 1 つあります。言う:
import pandas as pd
import numpy as np
rng = pd.date_range('2013-01-01', periods=12, freq='H')
data = pd.Series(np.random.randn(len(rng)), index=rng)
そして、たとえば、より任意の時間の別のセット(実際には、これらの時間は規則的なシーケンスではありません)
ts_rng = pd.date_range('2013-01-01 01:11:21', periods=7, freq='87Min')
ts = pd.Series(index=ts_rng)
その時点で補間されたデータの値を ts で知りたいです。
私はnumpyでこれを行うことができます:
x = np.asarray(ts_rng,dtype=np.float64)
xp = np.asarray(data.index,dtype=np.float64)
fp = np.asarray(data)
ts[:] = np.interp(x,xp,fp)
しかし、パンダにはこの機能が などのどこかにあると思いますが resample
、reindex
うまく取得できません。