numpy.char.zfill#

char.zfill(a, width)[source]#

Return the numeric string left-filled with zeros

Calls str.zfill element-wise.

Parameters:
aarray_like, with np.bytes_ or np.str_ dtype

Input array.

widthint

Width of string to left-fill elements in a.

Returns:
outndarray, {str, unicode}

Output array of str or unicode, depending on input type

See also

str.zfill

Examples

>>> np.strings.zfill('1', 3)
array('001', dtype='<U3')