bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / strings / zfill
_ArrayFunctionDispatcher
numpy.strings:zfill
source: build-install/usr/lib/python3.14/site-packages/numpy/_core/strings.py :894
Signature
def zfill ( a , width ) Summary
Return the numeric string left-filled with zeros. A leading sign prefix (+/-) is handled by inserting the padding after the sign character rather than before.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypewidth: array_like, with any integer dtypeWidth of string to left-fill elements in
a.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input type
Examples
import numpy as np np.strings.zfill(['1', '-1', '+1'], 3)✓
See also
- str.zfill
Aliases
-
numpy.char.zfill