pandas.Series.str.decode
- Series.str.decode(encoding, errors='strict', dtype=None)[source]
-
Decode character string in the Series/Index using indicated encoding.
Equivalent to
str.decode()
in python2 andbytes.decode()
in python3.- Parameters:
-
- encoding:str
- errors:str, optional
-
Specifies the error handling scheme. Possible values are those supported by
bytes.decode()
. - dtype:str or dtype, optional
-
The dtype of the result. When not
None
, must be either a string or object dtype. WhenNone
, the dtype of the result is determined bypd.options.future.infer_string
.Added in version 2.3.0.
- Returns:
-
- Series or Index
Examples
For Series:
>>> ser = pd.Series([b'cow', b'123', b'()']) >>> ser.str.decode('ascii') 0 cow 1 123 2 () dtype: object
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Series.str.decode.html