pandas 1.4.2

AttributesMethodsNotesParametersBackRef

Attributes

None :
versionadded
warning

StringArray is considered experimental. The implementation and parts of the API may change without warning.

Methods

Notes

StringArray returns a BooleanArray for comparison methods.

Parameters

values : array-like

The array of data.

warning

Currently, this expects an object-dtype ndarray where the elements are Python strings or :None:attr:`pandas.NA`. This may change without warning in the future. Use :None:meth:`pandas.array` with dtype="string" for a stable way of creating a :None:None:`StringArray` from any sequence.

copy : bool, default False

Whether to copy the array of data.

Extension array for string data.

See Also

Series.str

The string methods are available on Series backed by a StringArray.

array

The recommended function for creating a StringArray.

Examples

This example is valid syntax, but we were not able to check execution
>>> pd.array(['This is', 'some text', None, 'data.'], dtype="string")
<StringArray>
['This is', 'some text', <NA>, 'data.']
Length: 4, dtype: string

Unlike arrays instantiated with dtype="object" , StringArray will convert the values to strings.

This example is valid syntax, but we were not able to check execution
>>> pd.array(['1', 1], dtype="object")
<PandasArray>
['1', 1]
Length: 2, dtype: object
This example is valid syntax, but we were not able to check execution
>>> pd.array(['1', 1], dtype="string")
<StringArray>
['1', '1']
Length: 2, dtype: string

However, instantiating StringArrays directly with non-strings will raise an error.

For comparison methods, StringArray returns a pandas.BooleanArray :

This example is valid syntax, but we were not able to check execution
>>> pd.array(["a", None, "c"], dtype="string") == "a"
<BooleanArray>
[True, <NA>, False]
Length: 3, dtype: boolean
See :

Back References

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

pandas.core.arrays.string_.StringArray

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/arrays/string_.py#230
type: <class 'abc.ABCMeta'>
Commit: