- API reference
- Series
- pandas.Series.values
pandas.Series.values#
- propertySeries.values[source]#
Return Series as ndarray or ndarray-like depending on the dtype.
Warning
We recommend using
Series.array
orSeries.to_numpy()
, depending on whether you needa reference to the underlying data or a NumPy array.- Returns:
- numpy.ndarray or ndarray-like
See also
Series.array
Reference to the underlying data.
Series.to_numpy
A NumPy array representing the underlying data.
Examples
>>>pd.Series([1,2,3]).valuesarray([1, 2, 3])
>>>pd.Series(list('aabc')).valuesarray(['a', 'a', 'b', 'c'], dtype=object)
>>>pd.Series(list('aabc')).astype('category').values['a', 'a', 'b', 'c']Categories (3, object): ['a', 'b', 'c']
Timezone aware datetime data is converted to UTC:
>>>pd.Series(pd.date_range('20130101',periods=3,...tz='US/Eastern')).valuesarray(['2013-01-01T05:00:00.000000000', '2013-01-02T05:00:00.000000000', '2013-01-03T05:00:00.000000000'], dtype='datetime64[ns]')
On this page