What is the numpy.char.isupper() function in Python?

Overview

The char.isupper() function in Python returns True for each element of an input array of string, if all cased characters in the string are uppercase and there is at least one character, and returns False if it is otherwise.

Syntax

char.isupper(a)
Syntax for the char.isupper() function

Parameter

The char.isupper() function takes a single parameter value, a, which represents the input array.

Return value

The char.isupper() function returns an output array of Boolean values of the same shape as the input array a.

Example

Let's look at the code below:

import numpy as np
# creating an input array
a = np.array(['UPPERCASE', "Uppercase", "UPPERcase", "uppercase",])
# implementing the char.isupper() function
myarray = np.char.isupper(a)
# printing the input array
print(a)
# printing the output arrays
print(myarray)

Free Resources