pandas.Series.values

Return Series as ndarray or ndarray-like depending on the dtype.

Warning

We recommend using Series.array or Series.to_numpy(), depending on whether you need a reference to the underlying data or a NumPy array.

return

numpy.ndarray or ndarray-like

Examples

Return Series as ndarray or ndarray-like depending on the dtype.
import numpy as np
import pandas as pd
from numba import njit


@njit
def series_values():
    series = pd.Series(np.arange(5))

    return series.values  # Expect array of 0, 1, 2, 3, 4


print(series_values())
$ python ./series/series_values.py
[0 1 2 3 4]

See also

Series.array

Reference to the underlying data.

Series.to_numpy

A NumPy array representing the underlying data.