pandas.Series.index

The index (axis labels) of the Series.

Limitations

  • This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff

    between staying in JIT-region with that function or going back to interpreter mode.

Examples

The index (axis labels) of the Series.
import numpy as np
import pandas as pd
from numba import njit


@njit
def series_index():
    series = pd.Series(np.arange(5), index=['one', 'two', 'three', 'four', 'five'])

    return series.index  # Expect array of 'one' 'two' 'three' 'four' 'five'


print(series_index())
$ python ./series/series_index.py
['one' 'two' 'three' 'four' 'five']