numpy string operations | isspace() function Last Updated : 15 Jan, 2019 Comments Improve Suggest changes Like Article Like Report numpy.core.defchararray.isspace(arr) function returns true for each element if there are only whitespace characters in the string and there is at least one character.It returns false otherwise. Syntax: numpy.core.isspace(arr) Parameters: arr : array_like of str or unicode. Returns : [ndarray] Output array of bools. Code #1 : Python3 # Python program explaining # numpy.char.isspace() method import numpy as geek # input arrays not containing any space in_arr = geek.array([ 'Geeksforgeeks', 'Codechef'] ) print ("Input array : ", in_arr) out_arr = geek.char.isspace(in_arr) print ("Output array: ", out_arr) Output: Input array : ['Geeksforgeeks' 'Codechef'] Output array: [False False] Code #2 : Python3 # Python program explaining # numpy.char.isspace() method import numpy as geek # input arrays containing string along with space in_arr = geek.array([ 'Geeks\nfor\ngeeks', 'Code\tchef'] ) print ("Input array : ", in_arr) out_arr = geek.char.isspace(in_arr) print ("Output array: ", out_arr) Output: Input array : ['Geeks\nfor\ngeeks' 'Code\tchef'] Output array: [False False] Code #3 : Python3 # Python program explaining # numpy.char.isspace() method import numpy as geek # input arrays containing only white space in_arr = geek.array([ '\n', '\t', ' ', '\n\t '] ) print ("Input array : ", in_arr) out_arr = geek.char.isspace(in_arr) print ("Output array: ", out_arr) Output: Input array : ['\n' '\t' ' ' '\n\t '] Output array: [ True True True True] Comment More infoAdvertise with us Next Article numpy string operations | isspace() function jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads numpy string operations | isalpha() function numpy.core.defchararray.isalpha(arr) function returns True for each element if all characters in the string are alphabetic 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 # Pyth 1 min read Numpy - String Functions & Operations NumPy String functions belong to the numpy.char module and are designed to perform element-wise operations on arrays. These functions can help to handle and manipulate string data efficiently.Table of ContentString OperationsString Information String Comparison In this article, weâll explore the var 5 min read numpy string operations | istitle() function numpy.core.defchararray.istitle(arr) function returns True for each element in the array if the element is a titlecased string 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 # 1 min read numpy string operations | isdigit() function 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 p 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 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 | ljust() function numpy.core.defchararray.ljust(arr, width, fillchar=' ') is another function for doing string operations in numpy. It returns an array with the elements of arr left-justified in a string of length width. It fills remaining space of each array element using fillchr parameter. If fillchr is not passed 2 min read numpy string operations | zfill() function numpy.core.defchararray.zfill(arr, width) is another function for doing string operations in numpy. For each element in the array it returns the numeric string left-filled with zeros.The number of left filled zeros happen according to the width. Parameters: arr : array_like of str or unicode.Input a 2 min read numpy string operations | rjust() function numpy.core.defchararray.rjust(arr, width, fillchar=' ') is another function for doing string operations in numpy. It returns an array with the elements of arr right-justified in a string of length width.It fills remaining space of each array element using fillchr parameter.If fillchr is not passed t 2 min read Numpy string operations | rindex() function numpy.core.defchararray.rindex() function, raises ValueError when the substring sub is not found. Calls str.rindex element-wise. Syntax : numpy.core.defchararray.rindex(arr, sub, start = 0, end = None) Parameters : arr : [array-like of str or unicode] Array-like of str . sub : [str or unicode] Input 1 min read Like