The char.isnumeric()
function in Python returns `true`
if there are only numeric characters in the element of a given input array. Otherwise, it returns false
.
char.isnumeric(a)
The char.isnumeric()
function takes an array as a parameter.
The char.isnumeric()
function returns an array of boolean values with the same shape as the input array, a
.
import numpy as np# creating an input arraya = np.array(["Hi", "25", "3L", "6C", "2"])# invoking the char.isnumeric() functionmyarray = np.char.isnumeric(a)# printing the input arrayprint(a)# printing the output arraysprint(myarray)
numpy
module.a
using the array()
function of numpy.
char.isnumeric()
function on the input array. The result is assigned to a variable, myarray
.a
.myarray
.