8000 DOC: Add examples to ``np.char`` by luxedo · Pull Request #26642 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Add examples to np.char #26642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 14, 2024
Prev Previous commit
Next Next commit
DOC: add char.startswith example
[skip actions][skip azp][skip cirrus]
  • Loading branch information
luxedo committed Jun 8, 2024
commit 7d8de938d194e923c3986dea19d3782cc70ee2e5
10 changes: 10 additions & 0 deletions numpy/_core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,16 @@ def startswith(a, prefix, start=0, end=None):
--------
str.startswith

Examples
--------
>>> s = np.array(['foo', 'bar'])
>>> s
array(['foo', 'bar'], dtype='<U3')
>>> np.strings.startswith(s, 'ba')
array([False, True])
>>> np.strings.startswith(s, 'a', start=1, end=2)
array([False, True])

"""
end = end if end is not None else MAX
return _startswith_ufunc(a, prefix, start, end)
Expand Down
0