For each element, return the lowest index in the string where substring ``sub`` is found, such that ``sub`` is contained in the range [``start``, ``end``). Parameters ---------- a : array_like, with ``StringDType``, ``bytes_`` or ``str_`` dtype sub : array_like, with `
(a, sub, start=0, end=None)
| 254 | |
| 255 | @set_module("numpy.strings") |
| 256 | def find(a, sub, start=0, end=None): |
| 257 | """ |
| 258 | For each element, return the lowest index in the string where |
| 259 | substring ``sub`` is found, such that ``sub`` is contained in the |
| 260 | range [``start``, ``end``). |
| 261 | |
| 262 | Parameters |
| 263 | ---------- |
| 264 | a : array_like, with ``StringDType``, ``bytes_`` or ``str_`` dtype |
| 265 | |
| 266 | sub : array_like, with ``bytes_`` or ``str_`` dtype |
| 267 | The substring to search for. |
| 268 | |
| 269 | start, end : array_like, with any integer dtype |
| 270 | The range to look in, interpreted as in slice notation. |
| 271 | |
| 272 | Returns |
| 273 | ------- |
| 274 | y : ndarray |
| 275 | Output array of ints |
| 276 | |
| 277 | See Also |
| 278 | -------- |
| 279 | str.find |
| 280 | |
| 281 | Examples |
| 282 | -------- |
| 283 | >>> import numpy as np |
| 284 | >>> a = np.array(["NumPy is a Python library"]) |
| 285 | >>> np.strings.find(a, "Python") |
| 286 | array([11]) |
| 287 | |
| 288 | """ |
| 289 | end = end if end is not None else MAX |
| 290 | return _find_ufunc(a, sub, start, end) |
| 291 | |
| 292 | |
| 293 | @set_module("numpy.strings") |
no outgoing calls
no test coverage detected
searching dependent graphs…