You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / strings / capitalize

_ArrayFunctionDispatcher

numpy.strings:capitalize

source: /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