MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / ljust

Function ljust

site-packages/numpy/core/defchararray.py:978–1010  ·  view source on GitHub ↗

Return an array with the elements of `a` left-justified in a string of length `width`. Calls `str.ljust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optiona

(a, width, fillchar=' ')

Source from the content-addressed store, hash-verified

976
977@array_function_dispatch(_just_dispatcher)
978def ljust(a, width, fillchar=' '):
979 """
980 Return an array with the elements of `a` left-justified in a
981 string of length `width`.
982
983 Calls `str.ljust` element-wise.
984
985 Parameters
986 ----------
987 a : array_like of str or unicode
988
989 width : int
990 The length of the resulting strings
991 fillchar : str or unicode, optional
992 The character to use for padding
993
994 Returns
995 -------
996 out : ndarray
997 Output array of str or unicode, depending on input type
998
999 See also
1000 --------
1001 str.ljust
1002
1003 """
1004 a_arr = numpy.asarray(a)
1005 width_arr = numpy.asarray(width)
1006 size = long(numpy.max(width_arr.flat))
1007 if numpy.issubdtype(a_arr.dtype, numpy.string_):
1008 fillchar = asbytes(fillchar)
1009 return _vec_string(
1010 a_arr, (a_arr.dtype.type, size), 'ljust', (width_arr, fillchar))
1011
1012
1013@array_function_dispatch(_unary_op_dispatcher)

Callers 1

ljustMethod · 0.85

Calls 2

asbytesFunction · 0.90
maxMethod · 0.45

Tested by

no test coverage detected