Skip to content

BUG: Index doesn't have an .empty attribute #13207

Closed
@chris-b1

Description

@chris-b1

Code Sample, a copy-pastable example if possible

In [108]: i = pd.Index([])

In [109]: bool(i)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-109-43b3c3723ad4> in <module>()
----> 1 bool(i)

C:\Users\Chris\Anaconda\envs\py35\lib\site-packages\pandas\indexes\base.py in __nonzero__(self)
   1227         raise ValueError("The truth value of a {0} is ambiguous. "
   1228                          "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
-> 1229                          .format(self.__class__.__name__))
   1230 
   1231     __bool__ = __nonzero__

ValueError: The truth value of a Index is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

In [110]: i.empty
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-110-1524e0ba750e> in <module>()
----> 1 i.empty

AttributeError: 'Index' object has no attribute 'empty'

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions