bundles / numpy latest / numpy / strings / expandtabs
_ArrayFunctionDispatcher
numpy.strings:expandtabs
source: build-install/usr/lib/python3.14/site-packages/numpy/_core/strings.py :634
Signature
def expandtabs ( a , tabsize = 8 ) Summary
Return a copy of each string element where all tab characters are replaced by one or more spaces.
Extended Summary
Calls str.expandtabs element-wise.
Return a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given tabsize. The column number is reset to zero after each newline occurring in the string. This doesn't understand other non-printing characters or escape sequences.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypeInput array
tabsize: int, optionalReplace tabs with
tabsizenumber of spaces. If not given defaults to 8 spaces.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input type
Examples
import numpy as np a = np.array([' Hello world'])✓
See also
- str.expandtabs
Aliases
-
numpy.char.expandtabs