Pandas Series.values


Pandas Series.values

In this tutorial, we'll go through examples for the Pandas Series.values property, which returns the Series as an ndarray or ndarray-like object.


Examples for Series.values property

1. Get Series as ndarray

In the following program, we take a Series object in series_data, get the array data using Series.array property, and print the contents of the array to output.

Python Program

import pandas as pd

# Create a Pandas Series
series_data = pd.Series([10, 20, 30, 40, 50])

# Get Series as ndarray
series_as_ndarray = series_data.values

# Display the result
print(series_as_ndarray)

Output

[10 20 30 40 50]


Python Libraries