MCPcopy Index your code
hub / github.com/pydata/xarray / rindex

Method rindex

xarray/core/accessor_str.py:1844–1880  ·  view source on GitHub ↗

Return highest indexes in each strings where the substring is fully contained between [start:end]. This is the same as ``str.rfind`` except instead of returning -1, it raises a ValueError when the substring is not found. If `start`, `end`, or 'sub` is array-

(
        self,
        sub: str | bytes | Any,
        start: int | Any = 0,
        end: int | Any = None,
    )

Source from the content-addressed store, hash-verified

1842 return self._apply(func=func, func_args=(sub, start, end), dtype=int)
1843
1844 def rindex(
1845 self,
1846 sub: str | bytes | Any,
1847 start: int | Any = 0,
1848 end: int | Any = None,
1849 ) -> T_DataArray:
1850 """
1851 Return highest indexes in each strings where the substring is
1852 fully contained between [start:end]. This is the same as
1853 ``str.rfind`` except instead of returning -1, it raises a ValueError
1854 when the substring is not found.
1855
1856 If `start`, `end`, or 'sub` is array-like, they are broadcast
1857 against the array and applied elementwise.
1858
1859 Parameters
1860 ----------
1861 sub : str or array-like of str
1862 Substring being searched.
1863 If array-like, it is broadcast.
1864 start : int or array-like of int
1865 Left edge index.
1866 If array-like, it is broadcast.
1867 end : int or array-like of int
1868 Right edge index.
1869 If array-like, it is broadcast.
1870
1871 Returns
1872 -------
1873 found : array of int
1874
1875 Raises
1876 ------
1877 ValueError
1878 substring is not found
1879 """
1880 return self.index(sub, start=start, end=end, side="right")
1881
1882 def replace(
1883 self,

Callers 2

test_indexFunction · 0.80
test_index_broadcastFunction · 0.80

Calls 1

indexMethod · 0.95

Tested by 2

test_indexFunction · 0.64
test_index_broadcastFunction · 0.64