maxframe.dataframe.Series.str.rfind#

Series.str.rfind(sub, start: int = 0, end=None)#

返回 Series/Index 中每个字符串的最高索引。

返回的每个索引对应于子字符串在 [start:end] 范围内完全包含的位置。失败时返回 -1。等效于标准 str.rfind()

参数:
  • sub (str) -- 要搜索的子字符串。

  • start (int) -- 左边界索引。

  • end (int) -- 右边界索引。

返回:

A Series (if the input is a Series) or an Index (if the input is an Index) of the highest indexes corresponding to the positions where the substring is found in each string of the input.

返回类型:

Series or Index of int.

参见

find

返回每个字符串中的最低索引。

示例

对于 Series.str.find:

>>> import maxframe.dataframe as md
>>> ser = md.Series(["_cow_", "duck_", "do_v_e"])
>>> ser.str.find("_").execute()
0   0
1   4
2   2
dtype: int64

对于 Series.str.rfind:

>>> ser = md.Series(["_cow_", "duck_", "do_v_e"])
>>> ser.str.rfind("_").execute()
0   4
1   4
2   4
dtype: int64