當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cudf.core.column.string.StringMethods.lstrip用法及代碼示例

用法:

StringMethods.lstrip(to_strip: str = None) → SeriesOrIndex

刪除前導和尾隨字符。

從左側的係列/索引中的每個字符串中去除空格(包括換行符)或一組指定字符。等效於 str.lstrip()

參數

to_stripstr 或無,默認無

指定要刪除的字符集。這組字符的所有組合都將被刪除。如果 None 則刪除空格。

返回

對象的係列或索引

例子

>>> import cudf
>>> s = cudf.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', None])
>>> s.str.lstrip('123.')
0     Ant.
1     Bee!\n
2     Cat?\t
3       <NA>
dtype: object

相關用法


注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.column.string.StringMethods.lstrip。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。