Skip to content
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

"IndexingError: Unalignable boolean Series key provided" when passing an empty object Series #5877

Closed
sadruddin opened this issue Jan 8, 2014 · 6 comments · Fixed by #5880

Comments

@sadruddin
Copy link

commented Jan 8, 2014

For some reason, with 0.13, an empty object Series is interpreted as a boolean one, when using to fetch elements in another Series:

pandas.Series(['A', 'B'])[pandas.Series([], dtype=object)]

The following works though, so the dtype confusion seems to be confined to empty Series:

pandas.Series(['A', 'B'])[pandas.Series(['C'], dtype=object)]
@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 8, 2014

hmm...

the 2nd acts like a reindex, while the 1st is odd as well

marking as a bug/api issue...

what do you think they should do?

@sadruddin

This comment has been minimized.

Copy link
Author

commented Jan 8, 2014

Why do you think that the 2nd is odd? Isn't it what one would expect when passing a Series, i.e. something equivalent to passing an array (using the Series' values)?
I would expect the 1st to return the same thing as what happens when passing a Series of dtype float, i.e. an empty Series. N.B: This used to work in 0.12

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 8, 2014

@sadruddin see #5880
should close this

The handling of a bool dtyped indexer that is empty would raise in 0.12. I changed it to work in 0.13, but could go either way. thoughts? (its the 3rd one down)

@sadruddin

This comment has been minimized.

Copy link
Author

commented Jan 8, 2014

In my opinion, given bool's special case, any non-matching length bool dtyped pandas.Series, including with length 0, should raise an exception. So 0.12 behaviour seems logical to me.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 8, 2014

agreed....reverting back to that behavior..

@jreback jreback closed this in #5880 Jan 8, 2014

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 8, 2014

@sadruddin thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.