Skip to content
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

BUG: Raise TypeError when subracting DateTimeArray and other date types #59901

Closed

Conversation

KevsterAmp
Copy link
Contributor

@KevsterAmp KevsterAmp marked this pull request as draft September 26, 2024 11:40
@KevsterAmp
Copy link
Contributor Author

@rhshadrach - can you verify if my implementation here is correct? I'm not sure of this. A bit of guidance could be useful. Thanks

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is looking good, CI failures look unrelated. They'll be fixed outside of this PR.

@@ -18,6 +18,7 @@
import warnings

import numpy as np
import pandas
Copy link
Member

@rhshadrach rhshadrach Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be importing pandas at the top of a module like this - it will cause import cycles. Search for where DatetimeArray is imported in other parts of the code and follow those examples.

Copy link
Member

@rhshadrach rhshadrach Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, search what you want to import and see how other code does it.

grep --include \*.py -nre ".*import.*DatetimeArray"
pandas/core/ops/array_ops.py:535:            from pandas.core.arrays import DatetimeArray
pandas/core/dtypes/dtypes.py:858:        from pandas.core.arrays import DatetimeArray
pandas/core/dtypes/dtypes.py:944:        from pandas.core.arrays import DatetimeArray
pandas/core/dtypes/astype.py:105:            from pandas.core.arrays import DatetimeArray

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rhshadrach, I have removed this

@KevsterAmp KevsterAmp closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: provide better error message for pd.Timedelta - pd.Series[Timestamp]
2 participants