Skip to content

Tag Archives: Python numpy-String Operation

To split the elements of a given array with spaces we will use numpy.char.split(). It is a function for doing string operations in NumPy. It… Read More
Let us see how to repeat all elements of the given array of string 3 times. Example : Input : [‘Akash’, ‘Rohit’, ‘Ayush’, ‘Dhruv’, ‘Radhika’]… Read More
In this article, we will discuss how to insert a space between the characters of all elements of a given array of string. Example: Suppose we… Read More
In the numpy.core.defchararray.partition() function,  each element in arr, split the element as the first occurrence of sep, and return 3 strings containing the part before… Read More
In the numpy.core.defchararray.rpartition() function,  each element in arr, split the element as the last occurrence of sep, and return 3 strings containing the part before… Read More
In the numpy.core.defchararray.replace() function, each element in arr, return a copy of the string with all occurrences of substring old replaced by new. Syntax :… Read More
In this numpy.core.defchararray.splitlines() function, each element in arr, return a list of the lines in the element, breaking at line boundaries. Syntax : numpy.core.defchararray.splitlines(arr, keepends… Read More
 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… Read More
 numpy.core.defchararray.startswith() function returns a boolean array which is True where the string element in starts with prefix, otherwise False. Syntax : numpy.core.defchararray.startswith(arr, prefix, start =… Read More
In this article, we will discuss how to concatenate element-wise two arrays of string  Example : Input : A = ['Akash', 'Ayush', 'Diksha', 'Radhika'] B… Read More
numpy.char.str_len(arr) function is used for doing string operations in numpy. It returns the length of every string element wise. Parameters: arr : array_like of str… Read More
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… Read More
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… Read More
numpy.core.defchararray.join(sep, arr) is another function for doing string operations in numpy. For each element in arr, it returns a copy of the string in which… Read More
numpy.core.defchararray.rsplit(arr, sep=None, maxsplit=None) is another function for doing string operations in numpy. It returns a list of the words in the string, using sep as… Read More

Start Your Coding Journey Now!