pandas.api.extensions.ExtensionArray._from_sequence_of_strings#
- classmethod ExtensionArray._from_sequence_of_strings(strings, *, dtype, copy=False)[source]#
Construct a new ExtensionArray from a sequence of strings.
This method is used to parse string data into the appropriate scalar type for the ExtensionArray. It is commonly used when reading data from text files via parsers like
read_csv.- Parameters:
- stringsSequence
Each element will be an instance of the scalar type for this array,
cls.dtype.type.- dtypeExtensionDtype
Construct for this particular dtype. This should be a Dtype compatible with the ExtensionArray.
- copybool, default False
If True, copy the underlying data.
- Returns:
- ExtensionArray
See also
api.extensions.ExtensionArray._from_sequenceConstruct a new ExtensionArray from a sequence of scalars.
api.extensions.ExtensionArray._from_factorizedReconstruct an ExtensionArray after factorization.
Examples
>>> pd.arrays.IntegerArray._from_sequence_of_strings( ... ["1", "2", "3"], dtype=pd.Int64Dtype() ... ) <IntegerArray> [1, 2, 3] Length: 3, dtype: Int64