This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / 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_`` dtype

Input array of strings to capitalize.

Returns

out : ndarray

Output array of StringDType, bytes_ or str_ 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