Numpy’s char.lower()
function in Python is used to convert the elements of an array to lowercase.
char.lower(a)
The char.lower()
function takes a single parameter value (a
) that represents the input array of strings or Unicode.
The char.lower()
function returns an array of strings or Unicode, depending on the input type of a
.
import numpy as np# creating an arraymyarray = np.array(["hello", "theophilus ,", 'HOW', "are", "you today?"])# implementing the char.lower() functionprint(np.char.lower(myarray))
numpy
module as np
.myarray
using the array()
function and initialize it with five strings.char.lower()
function to covert the elements of the array into lower case. The print
function is used to display the result.