-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
unstack with DatetimeIndex with NaN gives "ValueError: cannot convert float NaN to integer" #7401
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
a secondary issue is that the display of
AND I think this is the cause of the error itself (in in that |
i'll take this one |
hm @jreback is null indexing supposed to work at all? e.g.,: This works:
this raises:
with |
one a single null indexer is supported (for getitem) |
ok thx just checking my sanity |
@jreback @jorisvandenbossche can we define what should happen in the first case? so this:
which currently raises should yield:
is that correct? |
looks right. (w/o the
|
I think this is more related to issue #7403 than this one (as it is a general issue with NaN's, not perse with datetimes). For the rest I think also a problem is with the ordering of the index. How is it defined that |
@jorisvandenbossche was just trying to work out a rough idea of what should happen, but yes not clear how nan should be sorted in these kinds of ops. in that case my knee-jerk reaction is to disallow it, for fear of a swarm of users wanting nans first and another swarm wanting nans last. of course to make people happy, someone will inevitably suggest a keyword argument but for consistency that would have to go in most index sorting ops which sounds like a lot of pain for very little benefit. i am however in favor of a more informative error message |
With following code:
unstacking gives:
I don't know if this should work (unstacking with NaN in the index), but at least this is not a very clear error message to know what could be going wrong.
The text was updated successfully, but these errors were encountered: