maxframe.dataframe.Series.str.endswith#
- Series.str.endswith(pat: str | tuple[str, ...], na: Scalar | lib.NoDefault = <no_default>) Series | Index#
测试每个字符串元素的结尾是否与模式匹配。
等效于
str.endswith()。- 参数:
- 返回:
一个布尔值 Series,表示给定模式是否与每个字符串元素的结尾匹配。
- 返回类型:
参见
str.endswithPython 标准库字符串方法。
Series.str.startswith与 endswith 相同,但测试字符串的开头。
Series.str.contains测试字符串元素是否包含模式。
示例
>>> import maxframe.tensor as mt >>> import maxframe.dataframe as md >>> s = md.Series(["bat", "bear", "caT", mt.nan]) >>> s.execute() 0 bat 1 bear 2 caT 3 NaN dtype: str
>>> s.str.endswith("t").execute() 0 True 1 False 2 False 3 False dtype: bool
>>> s.str.endswith(("t", "T")).execute() 0 True 1 False 2 True 3 False dtype: bool