I have several years of data like (as pandas TimeSeries):
1997-04-02 0.0
1997-04-03 0.0
1997-04-04 2.0
1997-04-05 2.0
1997-04-06 0.0
1997-04-07 0.0
1997-04-08 0.0
Date is Index of type 'pandas.core.indexes.datetimes.DatetimeIndex'
df.resample('Y').sum()
gives an error "cannot import name 'NaT'".
What is the source of the error? I tried to_datetime with format '%Y-%m-%d %H:%M:%S' but it doesn't help.
Full text of exception:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-342-df3b79446059> in <module>
12 globals()['df_'+col]=nm #.resample('M').sum()
13 df_dataKlin27417c=df_dataKlin27417.loc['1997-04-02':'1997-05-06']
---> 14 rex=df_dataKlin27417.resample('M').sum()
15 #rex
16 df_allst
~/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py in resample(self, rule, how, axis, fill_method, closed, label, convention, kind, loffset, limit, base, on, level)
7102 Show which entries in a DataFrame are not NA.
7103
-> 7104 >>> df = pd.DataFrame({'age': [5, 6, np.NaN],
7105 ... 'born': [pd.NaT, pd.Timestamp('1939-05-27'),
7106 ... pd.Timestamp('1940-04-25')],
~/anaconda3/lib/python3.6/site-packages/pandas/core/resample.py in <module>
7
8 from pandas._libs import lib
----> 9 from pandas._libs.tslibs import NaT, Timestamp
10 from pandas._libs.tslibs.frequencies import is_subperiod, is_superperiod
11 from pandas._libs.tslibs.period import IncompatibleFrequency
ImportError: cannot import name 'NaT'