Skip to main content
`Ctrl`+`K`

# numpy.char.zfill

char.zfill(a, width)

  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_` dtype
    width array_like, with any integer dtype

      Width of string to left-fill elements in a.

  Returns:
    out ndarray

      Output array of `StringDType`, `bytes_` or `str_` dtype, depending on input type

  See also

  `str.zfill`

  Examples

      >>> import numpy as np
      >>> np.strings.zfill(['1', '-1', '+1'], 3)
      array(['001', '-01', '+01'], dtype='<U3')