xarray.DataArray.str.zfill

DataArray.str.zfill(width)[source]

Pad each string in the array by prepending ‘0’ characters.

Strings in the array are padded with ‘0’ characters on the left of the string to reach a total string length width. Strings in the array with length greater or equal to width are unchanged.

If width is array-like, it is broadcast against the array and applied elementwise.

Parameters

width (int or array-like of int) – Minimum length of resulting string; strings with length less than width be prepended with ‘0’ characters. If array-like, it is broadcast.

Returns

filled (same type as values)