Shortcuts

torcharrow.istring_column.StringMethods.split

abstract StringMethods.split(pat=None, n=- 1)

围绕给定的分隔符/定界符拆分字符串。

Parameters:
  • str (pat -) – 用于分割的字符串字面量,目前还不支持正则表达式。 当为 None 时,根据空白字符进行分割。

  • None (默认) – 用于分割的字符串字面量,尚不支持正则表达式。 当为 None 时,根据空白字符进行分割。

  • int (n -) – 最大分割次数。0 将被解释为返回所有分割。

  • limit (默认 -1 表示不限制) – 最大分割次数。0 将被解释为返回所有分割。

另请参阅

list.join

示例

>>> import torcharrow as ta
>>> s = ta.column(['what a wonderful world!', 'really?'])
>>> s.str.split(pat=' ')
0  ['what', 'a', 'wonderful', 'world!']
1  ['really?']
dtype: List(string), length: 2, null_count: 0
>>> s.str.split(pat=' ', n=2)
0  ['what', 'a', 'wonderful world!']
1  ['really?']
dtype: List(string), length: 2, null_count: 0