Skip to content

Drop with boolean raises a ValueError #6189

Closed
@jseabold

Description

@jseabold

Shouldn't this work?

>>> pd.version.version
'0.13.0-472-g9109812'

>>> df = pd.DataFrame(np.random.random((10,4)))

>>> df = df.drop(df[0] > .5)

>>> df.drop(df[0] < .2)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-23-5df7f56de272> in <module>()
----> 1 df.drop(df[0] > .5)

/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_472_g9109812-py2.7-linux-x86_64.egg/pandas/core/generic.pyc in drop(self, labels, axis, level, inplace, **kwargs)
   1397                 new_axis = axis.drop(labels, level=level)
   1398             else:
-> 1399                 new_axis = axis.drop(labels)
   1400             dropped = self.reindex(**{axis_name: new_axis})
   1401             try:

/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_472_g9109812-py2.7-linux-x86_64.egg/pandas/core/index.pyc in drop(self, labels)
   1621         mask = indexer == -1
   1622         if mask.any():
-> 1623             raise ValueError('labels %s not contained in axis' % labels[mask])
   1624         return self.delete(indexer)
   1625 

ValueError: labels [False False  True  True  True  True  True False] not contained in axis

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignDuplicate ReportDuplicate issue or pull requestEnhancementIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions