dask.dataframe.Series.str.translate

dask.dataframe.Series.str.translate

dataframe.Series.str.translate(table)

Map all characters in the string through the given mapping table.

This docstring was copied from pandas.core.strings.accessor.StringMethods.translate.

Some inconsistencies with the Dask version may exist.

Equivalent to standard str.translate().

Parameters
tabledict

Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or None. Unmapped characters are left untouched. Characters mapped to None are deleted. str.maketrans() is a helper function for making translation tables.

Returns
Series or Index

Examples

>>> ser = pd.Series(["El niño", "Françoise"])  
>>> mytable = str.maketrans({'ñ': 'n', 'ç': 'c'})  
>>> ser.str.translate(mytable)  
0   El nino
1   Francoise
dtype: object