mars.dataframe.Series.str.repeat#

Series.str.repeat(repeats)#

在Series或Index中重复每个字符串。

Parameters

repeats (intintsequence) – 所有(int)相同值或每个(sequence)不同值。

Returns

由输入参数 repeats 指定的重复字符串对象的系列或索引。

Return type

系列索引对象

示例

>>> import mars.dataframe as md
>>> s = md.Series(['a', 'b', 'c'])
>>> s.execute()
0    a
1    b
2    c
dtype: object

在Series中重复单个整数字符串

>>> s.str.repeat(repeats=2).execute()
0    aa
1    bb
2    cc
dtype: object

整数序列重复相应的字符串在系列中

>>> s.str.repeat(repeats=[1, 2, 3]).execute()
0      a
1     bb
2    ccc
dtype: object