MCPcopy Index your code
hub / github.com/numpy/numpy / _split

Function _split

numpy/_core/strings.py:1400–1441  ·  view source on GitHub ↗

For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls :meth:`str.split` element-wise. Parameters ---------- a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype sep : str or unicode, optional

(a, sep=None, maxsplit=None)

Source from the content-addressed store, hash-verified

1398
1399@array_function_dispatch(_split_dispatcher)
1400def _split(a, sep=None, maxsplit=None):
1401 """
1402 For each element in `a`, return a list of the words in the
1403 string, using `sep` as the delimiter string.
1404
1405 Calls :meth:`str.split` element-wise.
1406
1407 Parameters
1408 ----------
1409 a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
1410
1411 sep : str or unicode, optional
1412 If `sep` is not specified or None, any whitespace string is a
1413 separator.
1414
1415 maxsplit : int, optional
1416 If `maxsplit` is given, at most `maxsplit` splits are done.
1417
1418 Returns
1419 -------
1420 out : ndarray
1421 Array of list objects
1422
1423 Examples
1424 --------
1425 >>> import numpy as np
1426 >>> x = np.array("Numpy is nice!")
1427 >>> np.strings.split(x, " ") # doctest: +SKIP
1428 array(list(['Numpy', 'is', 'nice!']), dtype=object) # doctest: +SKIP
1429
1430 >>> np.strings.split(x, " ", 1) # doctest: +SKIP
1431 array(list(['Numpy', 'is nice!']), dtype=object) # doctest: +SKIP
1432
1433 See Also
1434 --------
1435 str.split, rsplit
1436
1437 """
1438 # This will return an array of lists of different sizes, so we
1439 # leave it as an object array
1440 return _vec_string(
1441 a, np.object_, 'split', [sep] + _clean_args(maxsplit))
1442
1443
1444@array_function_dispatch(_split_dispatcher)

Callers

nothing calls this directly

Calls 1

_clean_argsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…