I have tried to recreate the demo from the "Getting Started" page on two different Jupyter Notebook platforms, and I consistently get the following error when I try to execute impact.run(): Can you tell me how to solve this problem? danoharris3635@gmail.com
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:91, in CausalImpact.run(self)
90 def run(self):
---> 91 kwargs = self._format_input(
92 self.params["data"],
93 self.params["pre_period"],
94 self.params["post_period"],
95 self.params["model_args"],
96 self.params["ucm_model"],
97 self.params["post_period_response"],
98 self.params["alpha"],
99 )
101 # Depending on input, dispatch to the appropriate Run* method()
102 if self.data is not None:
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:343, in CausalImpact._format_input(self, data, pre_period, post_period, model_args, ucm_model, post_period_response, alpha)
341 # Check and
342 if data is not None:
--> 343 checked = self._format_input_prepost(pre_period, post_period, data)
344 pre_period = checked["pre_period"]
345 post_period = checked["post_period"]
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:250, in CausalImpact._format_input_prepost(self, pre_period, post_period, data)
241 """Check and format the pre_period and post_period input arguments.
242
243 Args:
(...)
246 data: already-checked Pandas DataFrame, for reference only
247 """
248 self._check_periods_are_valid(pre_period, post_period)
--> 250 pre_period, post_period = self._align_periods_dtypes(
251 pre_period, post_period, data
252 )
254 if pre_period[1] > post_period[0]:
255 raise ValueError(
256 "post period must start at least 1 observation"
257 + " after the end of the pre_period"
258 )
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:186, in CausalImpact._align_periods_dtypes(pre_period, post_period, data)
184 pd.core.dtypes.common.is_datetime_or_timedelta_dtype(pre_period)
185 # if index is not datetime then error if datetime pre and post is passed
--> 186 elif pd.core.dtypes.common.is_datetime_or_timedelta_dtype(
187 pd.Series(pre_period)
188 ) or pd.core.dtypes.common.is_datetime_or_timedelta_dtype(
189 pd.Series(post_period)
190 ):
191 raise ValueError(
192 "pre_period ("
193 + pre_dtype.name
(...)
199 + ")"
200 )
201 # if index is int
AttributeError: module 'pandas.core.dtypes.common' has no attribute 'is_datetime_or_timedelta_dtype'
I have tried to recreate the demo from the "Getting Started" page on two different Jupyter Notebook platforms, and I consistently get the following error when I try to execute impact.run(): Can you tell me how to solve this problem? danoharris3635@gmail.com
AttributeError Traceback (most recent call last) Cell In[8], line 1 ----> 1 impact.run()
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:91, in CausalImpact.run(self) 90 def run(self): ---> 91 kwargs = self._format_input( 92 self.params["data"], 93 self.params["pre_period"], 94 self.params["post_period"], 95 self.params["model_args"], 96 self.params["ucm_model"], 97 self.params["post_period_response"], 98 self.params["alpha"], 99 ) 101 # Depending on input, dispatch to the appropriate Run* method() 102 if self.data is not None:
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:343, in CausalImpact._format_input(self, data, pre_period, post_period, model_args, ucm_model, post_period_response, alpha) 341 # Check and
342 if data is not None:
--> 343 checked = self._format_input_prepost(pre_period, post_period, data)
344 pre_period = checked["pre_period"]
345 post_period = checked["post_period"]
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:250, in CausalImpact._format_input_prepost(self, pre_period, post_period, data) 241 """Check and format the pre_period and post_period input arguments. 242 243 Args: (...) 246 data: already-checked Pandas DataFrame, for reference only 247 """ 248 self._check_periods_are_valid(pre_period, post_period) --> 250 pre_period, post_period = self._align_periods_dtypes( 251 pre_period, post_period, data 252 ) 254 if pre_period[1] > post_period[0]: 255 raise ValueError( 256 "post period must start at least 1 observation" 257 + " after the end of the pre_period" 258 )
File /apps/jupyter/DanHarris/VirtualEnvironment/DanHarris/lib64/python3.11/site-packages/causalimpact/analysis.py:186, in CausalImpact._align_periods_dtypes(pre_period, post_period, data) 184 pd.core.dtypes.common.is_datetime_or_timedelta_dtype(pre_period) 185 # if index is not datetime then error if datetime pre and post is passed --> 186 elif pd.core.dtypes.common.is_datetime_or_timedelta_dtype( 187 pd.Series(pre_period) 188 ) or pd.core.dtypes.common.is_datetime_or_timedelta_dtype( 189 pd.Series(post_period) 190 ): 191 raise ValueError( 192 "pre_period (" 193 + pre_dtype.name (...) 199 + ")" 200 ) 201 # if index is int
AttributeError: module 'pandas.core.dtypes.common' has no attribute 'is_datetime_or_timedelta_dtype'