dtoolkit.accessor.series.to_zh#
- dtoolkit.accessor.series.to_zh(s: Series, /, *, locale: Literal['zh-hans', 'zh-hant', 'zh-cn', 'zh-sg', 'zh-tw', 'zh-hk', 'zh-my', 'zh-mo'] = 'zh-cn', dictionary: dict = None) Series [source]#
Simple conversion and localization between simplified and traditional Chinese.
- Parameters:
- locale{“zh-hans”, “zh-hant”, “zh-cn”, “zh-sg”, “zh-tw”, “zh-hk”, “zh-my”, “zh-mo”}, default “zh-cn”
Locale to convert to.
- dictionarydict, default None
A dictionary which updates the conversion table, eg.
{'from1': 'to1', 'from2': 'to2'}
- Returns:
- Series(string)
- Raises:
- ModuleNotFoundError
If don’t have module named ‘zhconv’.
- TypeError
If
s
is not string dtype.
See also
Examples
>>> import dtoolkit >>> import pandas as pd >>> s = pd.Series(['漢', '字']) >>> s 0 漢 1 字 dtype: object >>> s.to_zh(locale="zh-cn") 0 汉 1 字 dtype: object