numpy string operations | isdigit() function Last Updated : 14 Jan, 2019 Comments Improve Suggest changes Like Article Like Report numpy.core.defchararray.isdigit(arr) function returns True for each element if all characters in the string are digits and there is at least one character; returns false otherwise. Parameters: arr : array_like of str or unicode. Returns : [ndarray] Output array of bools. Code #1 : Python3 # Python program explaining # numpy.char.isdigit() method import numpy as geek # input array contains only digits in_arr = geek.array([ '1000', '2000'] ) print ("Input array : ", in_arr) out_arr = geek.char.isdigit(in_arr) print ("Output array: ", out_arr) Output: Input array : ['1000' '2000'] Output array: [ True True] Code #2 : Python3 # Python program explaining # numpy.char.isdigit() method import numpy as geek # input array contains digits along with space and alphabets in_arr = geek.array([ '1000 2', 'a1000', '1234 ab'] ) print ("Input array : ", in_arr) out_arr = geek.char.isdigit(in_arr) print ("Output array: ", out_arr) Output: Input array : ['1000 2' 'a1000' '1234 ab'] Output array: [False False False] Comment More infoAdvertise with us Next Article numpy string operations | isdigit() function jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads numpy string operations | isdecimal() function numpy.core.defchararray.isdecimal(arr) function returns True for each element if there are only decimal characters in the element.It returns false otherwise. Parameters: arr : array_like of str or unicode. Returns : [ndarray] Output array of bools. Code #1 : Python3 # Python program explaining # num 1 min read numpy string operations | isnumeric() function numpy.core.defchararray.isnumeric(arr) function returns true for each element if there are only numeric characters and there is at least one character.It returns false otherwise. Parameters: arr : array_like of str or unicode. Returns : [ndarray] Output array of bools. Code #1 : Python3 # Python pro 1 min read Python String isdigit() Method The isdigit() method is a built-in Python function that checks if all characters in a string are digits. This method returns True if each character in the string is a numeric digit (0-9) and False otherwise. Example:Pythona = "12345" print(a.isdigit()) b = "1234a5" print(b.isdigit())OutputTrue False 3 min read Convert String to Int in Python In Python, converting a string to an integer is important for performing mathematical operations, processing user input and efficiently handling data. This article will explore different ways to perform this conversion, including error handling and other method to validate input string during conver 3 min read Check If String is Integer in Python In this article, we will explore different possible ways through which we can check if a string is an integer or not. We will explore different methods and see how each method works with a clear understanding.Example:Input2 : "geeksforgeeks"Output2 : geeksforgeeks is not an IntigerExplanation : "gee 4 min read Python | math.gcd() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.gcd() function compute the greatest common divisor of 2 numbers mentioned in its arguments. Syntax: math.gcd(x, y) Parameter: x : Non-negative integer whose gcd has to be comp 2 min read Implement IsNumber() function in Python In this article we will see how to implement isNumber() method using Python. This method takes in a string as input and returns True or False according to whether the string is a number or not. Examples: Input : "12345" Output : True Input : "-12345" Output : True Input : "abc" Output : False Approa 2 min read Python String isnumeric() Method The isnumeric() method is a built-in method in Python that belongs to the string class. It is used to determine whether the string consists of numeric characters or not. It returns a Boolean value. If all characters in the string are numeric and it is not empty, it returns âTrueâ If all characters i 3 min read Python string isdecimal() Method In Python, the isdecimal() method is a quick and easy way to check if a string contains only decimal digits. It works by returning True when the string consists of digits from 0 to 9 and False otherwise. This method is especially useful when we want to ensure that user inputs or string data are stri 3 min read How to convert string to integer in Python? In Python, a string can be converted into an integer using the following methods : Method 1: Using built-in int() function: If your string contains a decimal integer and you wish to convert it into an int, in that case, pass your string to int() function and it will convert your string into an equiv 3 min read Like