NumPy istitle() function

The istitle() function returns true for each data element of the given ndarray if the elements in the input ndarray is a title cased string and there is at least one cased character. Otherwise, this function will return false.

For example, Apple is title cased, but apple is not and APPLE is also not titled case.

This function calls str.istitle in an element-wise manner.

This function is locale-dependent for an 8-bit string.

Syntax of istitle():

The syntax required to use this function is as follows:


The above syntax indicates that istitle() is a function of the char module and it takes a single parameter.

In the above syntax, the argument a represents the input array of strings on which this function will be applied.

Returned Values:

This function will return an output array of boolean values.

Example 1:

import numpy as np 

inp1 = np.array(['APPLE', 'Mango', 'guava']) 
print ("The input array: ", inp1) 
out1 = np.char.istitle(inp1) 
print ("The output array:", out1 ) 


The input array : ['APPLE' 'Mango' 'guava'] 
The output array : [False True False]

Example 2:

The code snippet is as follows where we will use istitle() function:

import numpy as np 

inp2 = "This Is An Input String"
print ("The input array : \n", inp2) 

out2 = np.char.istitle(inp2) 
print ("The output array :\n", out2 ) 


The input array : 
This Is An Input String 

The output array : 
Follow Us On