No Results in DataFrame Resample (pandas)

Viewed 4268

I have a dataframe (df) which looks like this:

      Time          Temp
2017-01-01 00:30:00 11.1
2017-01-01 01:00:00 10.8
2017-01-01 01:30:00 10.8
2017-01-01 02:00:00 10.8
2017-01-01 02:30:00 11.1
.....             ....

I'm trying to get the hourly averages of the Temp data, I used to do it with the following code (Time is the index):

df2 = df.resample('H').agg(['mean','std'])

But now I'm getting the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-8-b43bf44dcae3> in <module>()
----> 1 df9 = dfroof4.resample('H').agg(['mean','std'])

D:\Anaconda3\lib\site-packages\pandas\core\resample.py in aggregate(self, arg, *args, **kwargs)
    314 
    315         self._set_binner()
--> 316         result, how = self._aggregate(arg, *args, **kwargs)
    317         if result is None:
    318             result = self._groupby_and_aggregate(arg,

D:\Anaconda3\lib\site-packages\pandas\core\base.py in _aggregate(self, arg, *args, **kwargs)
    632             return self._aggregate_multiple_funcs(arg,
    633                                                   _level=_level,
--> 634                                                   _axis=_axis), None
    635         else:
    636             result = None

D:\Anaconda3\lib\site-packages\pandas\core\base.py in _aggregate_multiple_funcs(self, arg, _level, _axis)
    689         # if we are empty
    690         if not len(results):
--> 691             raise ValueError("no results")
    692 
    693         try:

ValueError: no results

Any ideas?

EDIT:

the output of

print(df.dtypes)

is:

Temp    object
dtype: object

Thanks!

1 Answers
Related