pandas 1.4.2

ParametersReturnsBackRef
extract_array(obj: 'object', extract_numpy: 'bool' = False, extract_range: 'bool' = False) -> 'Any | ArrayLike'

For all other types, :None:None:`obj` is just returned as is.

Parameters

obj : object

For Series / Index, the underlying ExtensionArray is unboxed.

extract_numpy : bool, default False

Whether to extract the ndarray from a PandasArray.

extract_range : bool, default False

If we have a RangeIndex, return range._values if True (which is a materialized integer ndarray), otherwise return unchanged.

Returns

arr : object

Extract the ndarray or ExtensionArray from a Series or Index.

Examples

This example is valid syntax, but we were not able to check execution
>>> extract_array(pd.Series(['a', 'b', 'c'], dtype='category'))
['a', 'b', 'c']
Categories (3, object): ['a', 'b', 'c']

Other objects like lists, arrays, and DataFrames are just passed through.

This example is valid syntax, but we were not able to check execution
>>> extract_array([1, 2, 3])
[1, 2, 3]

For an ndarray-backed Series / Index the ndarray is returned.

This example is valid syntax, but we were not able to check execution
>>> extract_array(pd.Series([1, 2, 3]))
array([1, 2, 3])

To extract all the way down to the ndarray, pass extract_numpy=True .

This example is valid syntax, but we were not able to check execution
>>> extract_array(pd.Series([1, 2, 3]), extract_numpy=True)
array([1, 2, 3])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.construction.extract_array

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/construction.py#379
type: <class 'function'>
Commit: