Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separato
(a, sep)
| 1200 | |
| 1201 | @array_function_dispatch(_partition_dispatcher) |
| 1202 | def partition(a, sep): |
| 1203 | """ |
| 1204 | Partition each element in `a` around `sep`. |
| 1205 | |
| 1206 | Calls `str.partition` element-wise. |
| 1207 | |
| 1208 | For each element in `a`, split the element as the first |
| 1209 | occurrence of `sep`, and return 3 strings containing the part |
| 1210 | before the separator, the separator itself, and the part after |
| 1211 | the separator. If the separator is not found, return 3 strings |
| 1212 | containing the string itself, followed by two empty strings. |
| 1213 | |
| 1214 | Parameters |
| 1215 | ---------- |
| 1216 | a : array_like, {str, unicode} |
| 1217 | Input array |
| 1218 | sep : {str, unicode} |
| 1219 | Separator to split each string element in `a`. |
| 1220 | |
| 1221 | Returns |
| 1222 | ------- |
| 1223 | out : ndarray, {str, unicode} |
| 1224 | Output array of str or unicode, depending on input type. |
| 1225 | The output array will have an extra dimension with 3 |
| 1226 | elements per input element. |
| 1227 | |
| 1228 | See Also |
| 1229 | -------- |
| 1230 | str.partition |
| 1231 | |
| 1232 | """ |
| 1233 | return _to_bytes_or_str_array( |
| 1234 | _vec_string(a, object_, 'partition', (sep,)), a) |
| 1235 | |
| 1236 | |
| 1237 | def _replace_dispatcher(a, old, new, count=None): |
no test coverage detected