Split the strings in the DataArray at the last occurrence of separator `sep`. This method splits the string at the last occurrence of `sep`, and returns 3 elements containing the part before the separator, the separator itself, and the part after the separator.
(
self,
dim: Hashable | None,
sep: str | bytes | Any = " ",
)
| 2444 | return self._partitioner(func=self._obj.dtype.type.partition, dim=dim, sep=sep) |
| 2445 | |
| 2446 | def rpartition( |
| 2447 | self, |
| 2448 | dim: Hashable | None, |
| 2449 | sep: str | bytes | Any = " ", |
| 2450 | ) -> T_DataArray: |
| 2451 | """ |
| 2452 | Split the strings in the DataArray at the last occurrence of separator `sep`. |
| 2453 | |
| 2454 | This method splits the string at the last occurrence of `sep`, |
| 2455 | and returns 3 elements containing the part before the separator, |
| 2456 | the separator itself, and the part after the separator. |
| 2457 | If the separator is not found, return 3 elements containing two empty strings, |
| 2458 | followed by the string itself. |
| 2459 | |
| 2460 | If `sep` is array-like, it is broadcast against the array and applied |
| 2461 | elementwise. |
| 2462 | |
| 2463 | Parameters |
| 2464 | ---------- |
| 2465 | dim : hashable or None |
| 2466 | Name for the dimension to place the 3 elements in. |
| 2467 | If `None`, place the results as list elements in an object DataArray. |
| 2468 | sep : str or bytes or array-like, default: " " |
| 2469 | String to split on. |
| 2470 | If array-like, it is broadcast. |
| 2471 | |
| 2472 | Returns |
| 2473 | ------- |
| 2474 | rpartitioned : same type as values or object array |
| 2475 | |
| 2476 | See Also |
| 2477 | -------- |
| 2478 | DataArray.str.partition |
| 2479 | str.rpartition |
| 2480 | pandas.Series.str.rpartition |
| 2481 | """ |
| 2482 | return self._partitioner(func=self._obj.dtype.type.rpartition, dim=dim, sep=sep) |
| 2483 | |
| 2484 | def _splitter( |
| 2485 | self, |