Hello, I've been trying out the resampling method exposed in your video and e-book and what I've got from running the code is
Input:
import pandas as pd
import numpy as np
duration = pd.date_range('1/1/2012', periods=1000, freq='S')
ts = pd.Series(np.random.randint(0,5000, len(duration)), index=duration)
ts.resample('5Min').sum()
Output:
2012-01-01 00:00:00 687020 2012-01-01 00:05:00 747341 2012-01-01 00:10:00 706345 2012-01-01 00:15:00 249775 Freq: 5T, dtype: int32
Input:
ts.head()
Output:
2012-01-01 00:00:00 2569 2012-01-01 00:00:01 3238 2012-01-01 00:00:02 2631 2012-01-01 00:00:03 4249 2012-01-01 00:00:04 969 Freq: S, dtype: int32
""But:
Input;
ts.resample('5Min').head()
Output:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-11-0ba080de54bb> in <module> ----> 1 ts.resample('5Min').head() C:\Anaconda3\lib\site-packages\pandas\core\resample.py in __getattr__(self, attr) 108 return self[attr] 109 --> 110 return object.__getattribute__(self, attr) 111 112 def __iter__(self): AttributeError: 'DatetimeIndexResampler' object has no attribute 'head'
It looks like .head() is not an object attributable to resample('5Min)
Could you please help me run this code and reply with possible causes and solutions?
Thank you