Return lowest or highest indexes in each strings in the array where the substring is fully contained between [start:end]. Return -1 on failure. If `start`, `end`, or 'sub` is array-like, they are broadcast against the array and applied elementwise.
(
self,
sub: str | bytes | Any,
start: int | Any = 0,
end: int | Any = None,
side: str = "left",
)
| 1714 | return self._apply(func=func, func_args=(repeats,)) |
| 1715 | |
| 1716 | def find( |
| 1717 | self, |
| 1718 | sub: str | bytes | Any, |
| 1719 | start: int | Any = 0, |
| 1720 | end: int | Any = None, |
| 1721 | side: str = "left", |
| 1722 | ) -> T_DataArray: |
| 1723 | """ |
| 1724 | Return lowest or highest indexes in each strings in the array |
| 1725 | where the substring is fully contained between [start:end]. |
| 1726 | Return -1 on failure. |
| 1727 | |
| 1728 | If `start`, `end`, or 'sub` is array-like, they are broadcast |
| 1729 | against the array and applied elementwise. |
| 1730 | |
| 1731 | Parameters |
| 1732 | ---------- |
| 1733 | sub : str or array-like of str |
| 1734 | Substring being searched. |
| 1735 | If array-like, it is broadcast. |
| 1736 | start : int or array-like of int |
| 1737 | Left edge index. |
| 1738 | If array-like, it is broadcast. |
| 1739 | end : int or array-like of int |
| 1740 | Right edge index. |
| 1741 | If array-like, it is broadcast. |
| 1742 | side : {"left", "right"}, default: "left" |
| 1743 | Starting side for search. |
| 1744 | |
| 1745 | Returns |
| 1746 | ------- |
| 1747 | found : array of int |
| 1748 | """ |
| 1749 | sub = self._stringify(sub) |
| 1750 | |
| 1751 | if side == "left": |
| 1752 | method = "find" |
| 1753 | elif side == "right": |
| 1754 | method = "rfind" |
| 1755 | else: # pragma: no cover |
| 1756 | raise ValueError("Invalid side") |
| 1757 | |
| 1758 | func = lambda x, isub, istart, iend: getattr(x, method)(isub, istart, iend) |
| 1759 | return self._apply(func=func, func_args=(sub, start, end), dtype=int) |
| 1760 | |
| 1761 | def rfind( |
| 1762 | self, |