Skip to content

Error with all boolean indices for Series #8522

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

Closed
ducky427 opened this issue Oct 9, 2014 · 5 comments · Fixed by #8523
Closed

Error with all boolean indices for Series #8522

ducky427 opened this issue Oct 9, 2014 · 5 comments · Fixed by #8523
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@ducky427
Copy link

ducky427 commented Oct 9, 2014

The following code works fine with pandas 0.14.1

import pandas as pd
pd.Series([1, 1], index=[True, False]).drop(True)

Output:

False    1
dtype: int64

In pandas 0.15rc1, the code blows up and produces the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-35-f9a275b6ce2c> in <module>()
----> 1 pd.Series([1, 1], index=[True, False]).drop(True)

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/core/generic.pyc in drop(self, labels, axis, level, inplace, **kwargs)
   1531         axis, axis_ = self._get_axis(axis), axis
   1532 
-> 1533         if axis.is_unique:
   1534             if level is not None:
   1535                 if not isinstance(axis, MultiIndex):

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/lib.so in pandas.lib.cache_readonly.__get__ (pandas/lib.c:38943)()

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/core/index.pyc in is_unique(self)
    582     def is_unique(self):
    583         """ return if the index has unique values """
--> 584         return self._engine.is_unique
    585 
    586     def is_integer(self):

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/index.so in pandas.index.IndexEngine.is_unique.__get__ (pandas/index.c:4449)()

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/index.so in pandas.index.IndexEngine._do_unique_check (pandas/index.c:4901)()

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/index.so in pandas.index.IndexEngine._ensure_mapping_populated (pandas/index.c:5106)()

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/index.so in pandas.index.IndexEngine.initialize (pandas/index.c:5203)()

/home/d/.virtualenvs/test/local/lib/python2.7/site-packages/pandas-0.15.0rc1-py2.7-linux-x86_64.egg/pandas/hashtable.so in pandas.hashtable.PyObjectHashTable.map_locations (pandas/hashtable.c:12440)()

ValueError: Does not understand character buffer dtype format string ('?')

Is this the expected behaviour in the new release?

cheers

@jreback
Copy link
Contributor

jreback commented Oct 9, 2014

doesn't seem very friendly!

has to do with with changing of the Index to not-subclass. This example creates in effect a Index([True,False,dtype='bool') where in 0.14.1 it is Index=([True,False],dtype='object') as we don't have a real BooleanIndex sub-class of Index (nor should we have one I think).

thanks for reporting

@jreback jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version and removed Bug labels Oct 9, 2014
@jreback jreback added this to the 0.15.0 milestone Oct 9, 2014
@ducky427
Copy link
Author

ducky427 commented Oct 9, 2014

Thanks!

@jreback
Copy link
Contributor

jreback commented Oct 9, 2014

should be fixed by #8523

@jreback
Copy link
Contributor

jreback commented Oct 9, 2014

done!

@ducky427
Copy link
Author

Thanks a lot. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants