pyspark.pandas.Series.str.find¶
-
str.
find
(sub: str, start: int = 0, end: Optional[int] = None) → pyspark.pandas.series.Series¶ Return lowest indexes in each strings in the Series where the substring is fully contained between [start:end].
Return -1 on failure. Equivalent to standard
str.find()
.- Parameters
- substr
Substring being searched.
- startint
Left edge index.
- endint
Right edge index.
- Returns
- Series of int
Series of lowest matching indexes.
Examples
>>> s = ps.Series(['apple', 'oranges', 'bananas'])
>>> s.str.find('a') 0 0 1 2 2 1 dtype: int64
>>> s.str.find('a', start=2) 0 -1 1 2 2 3 dtype: int64
>>> s.str.find('a', end=1) 0 0 1 -1 2 -1 dtype: int64
>>> s.str.find('a', start=2, end=2) 0 -1 1 -1 2 -1 dtype: int64