bundles / numpy latest / numpy / strings / capitalize
_ArrayFunctionDispatcher
numpy.strings:capitalize
source: build-install/usr/lib/python3.14/site-packages/numpy/_core/strings.py :1201
Signature
def capitalize ( a ) Summary
Return a copy of a with only the first character of each element capitalized.
Extended Summary
Calls str.capitalize element-wise.
For byte strings, this method is locale-dependent.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypeInput array of strings to capitalize.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input types
Examples
import numpy as np
✓c = np.array(['a1b2','1b2a','b2a1','2a1b'],'S4'); c np.strings.capitalize(c)✗
See also
- str.capitalize
Aliases
-
numpy.char.capitalize