def test_period_with_agg(self):
# aggregate a period resampler with a lambda
s2 = pd.Series(np.random.randint(0, 5, 50),
index=pd.period_range('2012-01-01',
freq='H',
periods=50),
dtype='float64')
expected = s2.to_timestamp().resample('D').mean().to_period()
result = s2.resample('D').agg(lambda x: x.mean())
assert_series_equal(result, expected)
test_resample.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录