# numpy.char.center

char.center(a, width, fillchar=' ')

  Return a copy of a with its elements centered in a string of length width.

  Calls str.center element-wise.

  Parameters:
    a array_like of str or unicode
    width int

      The length of the resulting strings

    fillchar str or unicode, optional

      The padding character to use (default is space).

  Returns:
    out ndarray

      Output array of str or unicode, depending on input types

  See also

  `str.center`

  Notes

  This function is intended to work with arrays of strings. The fill character is not applied to numeric types.

  Examples

      >>> c = np.array(['a1b2','1b2a','b2a1','2a1b']); c
      array(['a1b2', '1b2a', 'b2a1', '2a1b'], dtype='<U4')
      >>> np.char.center(c, width=9)
      array(['   a1b2  ', '   1b2a  ', '   b2a1  ', '   2a1b  '], dtype='<U9')
      >>> np.char.center(c, width=9, fillchar='*')
      array(['***a1b2**', '***1b2a**', '***b2a1**', '***2a1b**'], dtype='<U9')
      >>> np.char.center(c, width=1)
      array(['a', '1', 'b', '2'], dtype='<U1')