pandas.DataFrame.index

The index (row labels) of the DataFrame.

Examples

The index (row labels) of the DataFrame.
import pandas as pd
from numba import njit


@njit
def dataframe_index():
    df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}, index=['a', 'b'])
    result = df.index

    return result  # Numpy array of index values ['a', 'b']


print(dataframe_index())
$ python ./dataframe/dataframe_index.py
['a' 'b']