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.
For Series / Index, the underlying ExtensionArray is unboxed.
Whether to extract the ndarray from a PandasArray.
If we have a RangeIndex, return range._values if True (which is a materialized integer ndarray), otherwise return unchanged.
Extract the ndarray or ExtensionArray from a Series or Index.
>>> 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
.
>>> extract_array(pd.Series([1, 2, 3]), extract_numpy=True) array([1, 2, 3])See :
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.construction.extract_array
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