-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: PeriodDtype incorrectly caching different DateOffset freqs #52991
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
Conversation
pandas/core/dtypes/dtypes.py:902: error: Incompatible types in assignment (expression has type "Dict[int, PandasExtensionDtype]", base class "PandasExtensionDtype" defined the type as "Dict[str, PandasExtensionDtype]") [assignment] This is one of the complaints I've been seeing locally for a while. No idea why its showing up now |
pandas/tests/arrays/test_period.py
Outdated
@@ -22,6 +22,15 @@ def test_registered(): | |||
assert result == expected | |||
|
|||
|
|||
def test_perioddtype_caching_dateoffset_normalize(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this go with other PeriodDtype tests (as opposed to the Array)
pandas/core/dtypes/dtypes.py
Outdated
@@ -899,7 +899,7 @@ class PeriodDtype(PeriodDtypeBase, PandasExtensionDtype): | |||
num = 102 | |||
_metadata = ("freq",) | |||
_match = re.compile(r"(P|p)eriod\[(?P<freq>.+)\]") | |||
_cache_dtypes: dict[int, PandasExtensionDtype] = {} | |||
_cache_dtypes: dict[BaseOffset, PandasExtensionDtype] = {} # type: ignore[assignment] # noqa:E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing the usual "# error: ..." in the previous line? should the value be PeriodDtype instead of PandasExtensionDtype?
thanks @mroeschke |
…as-dev#52991) * BUG: PeriodDtype incorrectly caching different DateOffset freqs * Change typing * Address review * Add more specific typing and error message
…as-dev#52991) * BUG: PeriodDtype incorrectly caching different DateOffset freqs * Change typing * Address review * Add more specific typing and error message
…as-dev#52991) * BUG: PeriodDtype incorrectly caching different DateOffset freqs * Change typing * Address review * Add more specific typing and error message
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.