-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error message for pandas attribute 'is_datetime_or_timedelta_dtype' #56
Comments
I am facing the same issue |
I'm encountering the same issue. could we please have it fixed? |
I encountered the same issue which was caused by a mismatch in Pandas versions. I would check which version of Pandas you have installed. In my case, I had version |
Thank you!
Best,
Dan
"*Aim for kindness, tolerance, and humility*" -- Dennis Boos
…On Tue, Jul 16, 2024 at 8:59 PM Chris Sanden ***@***.***> wrote:
I encountered the same issue which was caused by a mismatch in Pandas
versions. I would check which version of Pandas you have installed. In my
case, I had version 2.2.2 of Pandas installed. To remedy the issue, I
installed version 1.5.2 as defined in the requirements
<https://github.com/jamalsenouci/causalimpact/blob/master/requirements.txt#L76>
.
—
Reply to this email directly, view it on GitHub
<#56 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APPVTJWJWBYJD6NPH35SOTTZMW6Y3AVCNFSM6AAAAABJINR2U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGA4TQOBUGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thank you for sharing!
…On Tue, Jul 16, 2024, 6:08 PM doharris3635 ***@***.***> wrote:
Thank you!
Best,
Dan
"*Aim for kindness, tolerance, and humility*" -- Dennis Boos
On Tue, Jul 16, 2024 at 8:59 PM Chris Sanden ***@***.***>
wrote:
> I encountered the same issue which was caused by a mismatch in Pandas
> versions. I would check which version of Pandas you have installed. In
my
> case, I had version 2.2.2 of Pandas installed. To remedy the issue, I
> installed version 1.5.2 as defined in the requirements
> <
https://github.com/jamalsenouci/causalimpact/blob/master/requirements.txt#L76>
> .
>
> —
> Reply to this email directly, view it on GitHub
> <
#56 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/APPVTJWJWBYJD6NPH35SOTTZMW6Y3AVCNFSM6AAAAABJINR2U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGA4TQOBUGI>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#56 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEHY3LI2XACII5AVBYADX4TZMW7YVAVCNFSM6AAAAABJINR2U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSGEYDQNBZGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The problem is with line 184 in 'analysis.py': And if you don't want to mess with the source code |
Hi,
Could you please share the sample code to bypass the error? Should we still
downgrade pandas to 1.5.2 with this solution? Appreciate the help.
…On Wed, Jul 17, 2024, 10:12 AM kangsasha ***@***.***> wrote:
The problem is with line 184 in 'analysis.py':
pd.core.dtypes.common.is_datetime_or_timedelta_dtype(pre_period).
This line seems to do nothing. Just comment it out and the error will go
away.
I would PR it but don't know how yet.
—
Reply to this email directly, view it on GitHub
<#56 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEHY3LMG4DF43IVM2BZ3KP3ZM2QW3AVCNFSM6AAAAABJINR2U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTG44TQNZSGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I am not sure yet how it works but this issue was fixed in this PR: #50. Oh, it turns out this issue is a duplicate of this issue: #48 |
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? [email protected]
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 <pre_period> and <post_period>
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'
The text was updated successfully, but these errors were encountered: