You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
IPYNB for chapter 15, section "Basic RNNs" crashes on resampling a dataframe
To Reproduce
Please copy the code that fails here, using code blocks like this:
period=slice("2001", "2019")
df_monthly=df.resample('ME')
#.mean() # compute the mean for each monthrolling_average_12_months=df_monthly[period].rolling(window=12).mean()
And if you got an exception, please copy the full stacktrace here:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[25], line 4
2 df_monthly = df.resample('ME')
3 #.mean() # compute the mean for each month
----> 4 rolling_average_12_months = df_monthly[period].rolling(window=12).mean()
File C:\Programs\WPy64-31220\python-3.12.2.amd64\Lib\site-packages\pandas\core\base.py:244, in SelectionMixin.__getitem__(self, key)
242 else:
243 if key not in self.obj:
--> 244 raise KeyError(f"Column not found: {key}")
245 ndim = self.obj[key].ndim
246 return self._gotitem(key, ndim=ndim)
KeyError: "Column not found: slice('2001', '2019', None)"
Versions (please complete the following information):
OS: Win 11
Python: '3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]'
pandas: '2.2.0'
Additional info
There are two problems:
df_monthly.mean() does not work, unless the column day_type is dropped
df_monthly[period] also crashes (with the stacktrace as given above)
The text was updated successfully, but these errors were encountered:
Describe the bug
IPYNB for chapter 15, section "Basic RNNs" crashes on resampling a dataframe
To Reproduce
Please copy the code that fails here, using code blocks like this:
And if you got an exception, please copy the full stacktrace here:
Versions (please complete the following information):
Additional info
There are two problems:
df_monthly.mean()
does not work, unless the columnday_type
is droppeddf_monthly[period]
also crashes (with the stacktrace as given above)The text was updated successfully, but these errors were encountered: