pandas.Index.shape#

property Index.shape[source]#

Return a tuple of the shape of the underlying data.

Since an Index is always one-dimensional, this returns a tuple with a single element equal to the number of elements in the Index.

See also

Index.size

Return the number of elements in the underlying data.

Index.ndim

Number of dimensions of the underlying data, by definition 1.

Index.dtype

Return the dtype object of the underlying data.

Index.values

Return an array representing the data in the Index.

Examples

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.shape
(3,)