pandas.Index.empty#

property Index.empty[source]#

Indicator whether Index is empty.

Returns:
bool

If Index is empty, return True, if not return False.

See also

Index.size

Return the number of elements in the underlying data.

Examples

>>> idx_empty = pd.Index([1, 2, 3])
>>> idx_empty
Index([1, 2, 3], dtype='int64')
>>> idx_empty.empty
False
>>> idx_empty = pd.Index([])
>>> idx_empty
Index([], dtype='object')
>>> idx_empty.empty
True

If we only have NaNs in our DataFrame, it is not considered empty!

>>> idx_empty = pd.Index([np.nan, np.nan])
>>> idx_empty
Index([nan, nan], dtype='float64')
>>> idx_empty.empty
False