xarray.DataArray.str.pad#

DataArray.str.pad(width, side='left', fillchar=' ')[source]#

Pad strings in the array up to width.

If width or ‘fillchar` is array-like, they are broadcast against the array and applied elementwise.

Parameters:
  • width (int or array-like of int) – Minimum width of resulting string; additional characters will be filled with character defined in fillchar. If array-like, it is broadcast.

  • side ({"left", "right", "both"}, default: "left") – Side from which to fill resulting string.

  • fillchar (str or array-like of str, default: " ") – Additional character for filling, default is a space. If array-like, it is broadcast.

Returns:

filled (same type as values) – Array with a minimum number of char in each element.