用法:
StringMethods.wrap(width: int, **kwargs) → SeriesOrIndex
在係列/索引中包裝長字符串,以便在長度小於給定寬度的段落中格式化。
- width:int
最大線寬。
- 係列或索引
參數:
返回:
注意:
尚不支持參數
expand_tabsbool
,replace_whitespace
,drop_whitespace
,break_long_words
,break_on_hyphens
,expand_tabsbool
,如果將它們設置為任何值,將引發 NotImplementedError。該方法目前實現了R的stringr庫
str_wrap
函數的行為匹配,通過如下參數設置可以獲得等效的pandas實現:expand_tabs = 假
replace_whitespace = 真
drop_whitespace = 真
break_long_words = 假
break_on_hyphens = 假
例子:
>>> import cudf >>> data = ['line to be wrapped', 'another line to be wrapped'] >>> s = cudf.Series(data) >>> s.str.wrap(12) 0 line to be\nwrapped 1 another line\nto be\nwrapped dtype: object
相關用法
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python cudf.core.column.string.StringMethods.endswith用法及代碼示例
- Python cudf.core.column.string.StringMethods.title用法及代碼示例
- Python cudf.core.column.string.StringMethods.contains用法及代碼示例
- Python cudf.core.column.string.StringMethods.rsplit用法及代碼示例
- Python cudf.core.column.string.StringMethods.zfill用法及代碼示例
- Python cudf.core.column.string.StringMethods.hex_to_int用法及代碼示例
- Python cudf.core.column.string.StringMethods.htoi用法及代碼示例
- Python cudf.core.column.string.StringMethods.character_tokenize用法及代碼示例
- Python cudf.core.column.string.StringMethods.normalize_characters用法及代碼示例
- Python cudf.core.column.string.StringMethods.filter_alphanum用法及代碼示例
- Python cudf.core.column.string.StringMethods.split用法及代碼示例
- Python cudf.core.column.string.StringMethods.ngrams用法及代碼示例
- Python cudf.core.column.string.StringMethods.replace_with_backrefs用法及代碼示例
- Python cudf.core.column.string.StringMethods.insert用法及代碼示例
- Python cudf.core.column.string.StringMethods.pad用法及代碼示例
- Python cudf.core.column.string.StringMethods.replace用法及代碼示例
- Python cudf.core.column.string.StringMethods.rstrip用法及代碼示例
- Python cudf.core.column.string.StringMethods.replace_tokens用法及代碼示例
- Python cudf.core.column.string.StringMethods.cat用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.column.string.StringMethods.wrap。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。