-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Construction of Series with NAs and interval-of-datetime dtype raises error #41805
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
Comments
Thanks for reporting this @tlaytongoogle! Could you please add an informative title to the issue? |
Title added. |
Hi, I try to work on this problem. I am not sure whether this is considered bug. I notice that in this file pandas\tests\indexes\interval\test_astype.py, the function
The series [-1.5, np.nan, 0.0, 0.0, 1.5] in IntervalIndex index contains nan values. Based on test case, the expected result is TypeError: Cannot convert Float64Index to dtype datetime64[ns]; integer values are required for conversion which is same result from issue reported here. Thank |
@weikhor Consider that, in contrast to that test, it is entirely possible to convert the values from a
The key point here is that passing values into a constructor is not quite equivalent to casting with |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
Instantiating a
Series
with NA values indata
fails ifdtype
is specified asinterval[datetime64[ns]]
, raising an error:Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: