-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: Series([pd.NaT, None]) vs Index([pd.NaT, None]) #49340
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
As comparison, for other data types
So I think also those should be consistent with the above example? Also when passing an actual Timestamp scalar and not NaT, the None gets converted:
That all seems to hint towards choosing the Series behaviour? I suppose the only reason why
|
Maybe to summarize my comment above: I think we should choose a consistent behaviour for how One option could be that |
I generally agree with everything Joris said. I'd also have some sympathy to the argument: If a user explicitly chose to use two different NA-likes, they probably don't expect to get just one back. (a little bit like #49421). Either way, I care more that the behaviors be consistent than about which one we choose. |
@mroeschke thoughts? |
I guess I would be okay with the Series behavior of coercing
True, but given the coerce-y nature of pandas, I think we should definitely encourage users to |
Good news! Both the Series and Index behaviors are mostly lib.maybe_convert_objects. Changing |
The Series inference is done in maybe_infer_to_datetimelike, where infer_datetimelike_array returns "NaT". The Index inference is done in lib.maybe_convert_objects, which does not treat None as NaT.
Ideally this would match.
The text was updated successfully, but these errors were encountered: