Pandas Series property: array
An ExtensionArray in Pandas
The ExtensionArray of the data backing Pandas Series or Index.
Syntax:
Series.array
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 |
---|---|
category | Categorical |
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.
Example:
Download the Pandas Series Notebooks from here.
Previous: Series
Next: Series as ndarray or ndarray-like in Pandas
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework