Extract character number `i` from each string in the array. If `i` is array-like, they are broadcast against the array and applied elementwise. Parameters ---------- i : int or array-like of int Position of element to extract.
(
self,
i: int | Any,
default: str | bytes = "",
)
| 322 | return self._apply(func=lambda x, y: x % y, func_args=(other,)) |
| 323 | |
| 324 | def get( |
| 325 | self, |
| 326 | i: int | Any, |
| 327 | default: str | bytes = "", |
| 328 | ) -> T_DataArray: |
| 329 | """ |
| 330 | Extract character number `i` from each string in the array. |
| 331 | |
| 332 | If `i` is array-like, they are broadcast against the array and |
| 333 | applied elementwise. |
| 334 | |
| 335 | Parameters |
| 336 | ---------- |
| 337 | i : int or array-like of int |
| 338 | Position of element to extract. |
| 339 | If array-like, it is broadcast. |
| 340 | default : str or bytes, default: "" |
| 341 | Value for out-of-range index. |
| 342 | |
| 343 | Returns |
| 344 | ------- |
| 345 | items : array of object |
| 346 | """ |
| 347 | |
| 348 | def f(x, iind): |
| 349 | islice = slice(-1, None) if iind == -1 else slice(iind, iind + 1) |
| 350 | item = x[islice] |
| 351 | |
| 352 | return item or default |
| 353 | |
| 354 | return self._apply(func=f, func_args=(i,)) |
| 355 | |
| 356 | def slice( |
| 357 | self, |