-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Construction of series with na and datetime dtype #46068
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
Construction of series with na and datetime dtype #46068
Conversation
pandas/core/indexes/base.py
Outdated
elif ( | ||
is_float_dtype(self.dtype) | ||
and needs_i8_conversion(dtype) | ||
and not np.isnan(values).any() |
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 you add a comment about why this check is needed
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.
also use self.hasnans as it may be cached
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 you add a comment about why this check is needed
Hi, I just notice this. it is my mistake to add this.
…ction_of_series_with_NAs_and__datetime_dtype
…ction_of_series_with_NAs_and__datetime_dtype
@@ -774,6 +775,9 @@ def _try_cast( | |||
return maybe_cast_to_datetime(arr, dtype) | |||
# TODO: copy? | |||
|
|||
if isinstance(dtype, IntervalDtype) and isna(arr).all(): | |||
return np.asarray(arr).astype(IntervalDtype, copy=False) |
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.
this will always raise won't it?
I close this since I stuck this for long time. I get simpler task. Thank for review. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.