Pandas Series: array() function

An ExtensionArray in Pandas

The ExtensionArray of the data backing Pandas Series or Index.


Pandas Series array() function

Returns: ExtensionArray - An ExtensionArray of the values stored within.
For extension types, this is the actual array.
For NumPy native types, this is a thin (no copy) wrapper around numpy.ndarray.

Following table lays out the different array types for each extension dtype within pandas.

dtype array type


period PeriodArray
interval IntervalArray
IntegerNA IntegerArray
datetime64[ns, tz] DatetimeArray

For any 3rd-party extension types, the array type will be an ExtensionArray.
For all remaining dtypes .array will be a arrays.NumpyExtensionArray wrapping the actual ndarray stored within. If you absolutely need a NumPy array (possibly with copying / coercing data), then use Series.to_numpy() instead.


Download the above Notebook from here.

Previous: Series
Next: Series as ndarray or ndarray-like in Pandas