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 / swapcase

_ArrayFunctionDispatcher

numpy.strings:swapcase

source: build-install/usr/lib/python3.14/site-packages/numpy/_core/strings.py :1160

Signature

def   swapcase ( a )

Summary

Return element-wise a copy of the string with uppercase characters converted to lowercase and vice versa.

Extended Summary

Calls str.swapcase element-wise.

For 8-bit strings, this method is locale-dependent.

Parameters

a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype

Input array.

Returns

out : ndarray

Output array of StringDType, bytes_ or str_ dtype, depending on input types

Examples

import numpy as np
c=np.array(['a1B c','1b Ca','b Ca1','cA1b'],'S5'); c
np.strings.swapcase(c)

See also

str.swapcase

Aliases

  • numpy.char.swapcase