-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Bug cov nat #60898
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
base: main
Are you sure you want to change the base?
Bug cov nat #60898
Conversation
fbourgey
commented
Feb 9, 2025
- closes BUG: cov buggy when having NaT in column #53115
@jbrockmendel, @WillAyd, could you please take a look? |
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.
lgtm - @jbrockmendel anything else on your end?
pandas/core/internals/managers.py
Outdated
@@ -1800,6 +1800,8 @@ def as_array( | ||
arr = np.asarray(blk.values, dtype=dtype) | ||
else: | ||
arr = np.array(blk.values, dtype=dtype, copy=copy) | ||
if passed_nan and blk.dtype.kind in ["m", "M"]: |
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.
we usually do this check as in "mM"
as it is slightly faster
pandas/core/frame.py
Outdated
@@ -11350,6 +11352,13 @@ def cov( | ||
c -0.150812 0.191417 0.895202 | ||
""" | ||
data = self._get_numeric_data() if numeric_only else self | ||
dtypes = [blk.dtype for blk in self._mgr.blocks] | ||
if any(is_datetime64_any_dtype(d) or is_timedelta64_dtype(d) for d in dtypes): |
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.
i suspect that doing the check this way (instead of checking dtype.kind like you do below) will fail to exclude pyarrow duration dtypes.