Skip to content

Commit be75bec

Browse files
DOC: Add examples for np.strings.rfind()
1 parent 78a9810 commit be75bec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

numpy/_core/strings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,18 @@ def rfind(a, sub, start=0, end=None):
277277
--------
278278
str.rfind
279279
280+
Examples
281+
--------
282+
>>> import numpy as np
283+
>>> a = np.array(["Computer Science"])
284+
>>> np.strings.rfind(a, "Science", start=0, end=None)
285+
array([9])
286+
>>> np.strings.rfind(a, "Science", start=0, end=8)
287+
array([-1])
288+
>>> b = np.array(["Computer Science", "Science"])
289+
>>> np.strings.rfind(b, "Science", start=0, end=None)
290+
array([9, 0])
291+
280292
"""
281293
end = end if end is not None else MAX
282294
return _rfind_ufunc(a, sub, start, end)

0 commit comments

Comments
 (0)