numpy string operations | rsplit() function Last Updated : 05 Feb, 2019 Comments Improve Suggest changes Like Article Like Report 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 the delimiter string for each element in arr. The rsplit() method splits every string array element into a list, starting from the right whereas the split() method splits every string array element into a list, starting from the left. Parameters: arr : array_like of str or unicode.Input array. sep : [ str or unicode, optional] specifies the separator to use when splitting the string. maxsplit : [ int, optional] how many maximum splits to do. Returns : [ndarray] Output Array containing of list objects. Code #1 : Python3 # Python program explaining # numpy.char.rsplit() method # importing numpy import numpy as geek # input array in_arr = geek.array(['geeks for geeks']) print ("Input array : ", in_arr) # output array out_arr = geek.char.rsplit(in_arr) print ("Output splitted array: ", out_arr) Output: Input array : ['geeks for geeks'] Output splitted array: [['geeks', 'for', 'geeks']] Code #2 : Python3 # Python program explaining # numpy.char.rsplit() method # importing numpy import numpy as geek # input array in_arr = geek.array(['Num-py', 'Py-th-on', 'Pan-das']) print ("Input array : ", in_arr) # output array out_arr = geek.char.rsplit(in_arr, sep ='-') print ("Output splitted array: ", out_arr) Output: Input array : ['Num-py' 'Py-th-on' 'Pan-das'] Output splitted array: [['Num', 'py'] ['Py', 'th', 'on'] ['Pan', 'das']] Code #3 : Python3 # Python program explaining # numpy.char.rsplit() method # importing numpy import numpy as geek # input array in_arr = geek.array(['Num-py', 'Py-th-on', 'Pan-das']) print ("Input array : ", in_arr) # output array when maximum splitting # of every array element is 1 out_arr = geek.char.rsplit(in_arr, sep ='-', maxsplit = 1) print ("Output splitted array: ", out_arr) Output: Input array : ['Num-py' 'Py-th-on' 'Pan-das'] Output splitted array: [['Num', 'py'] ['Py-th', 'on'] ['Pan', 'das']] Comment More infoAdvertise with us Next Article String Manipulation in R J jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads Numpy string operations | rpartition() function 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 the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 strings containin 1 min read Python String rsplit() Method Python String rsplit() method returns a list of strings after breaking the given string from the right side by the specified separator. It's similar to the split() method in Python, but the difference is that rsplit() starts splitting from the end of the string rather than from the beginning. Exampl 3 min read Python String rsplit() Method Python String rsplit() method returns a list of strings after breaking the given string from the right side by the specified separator. It's similar to the split() method in Python, but the difference is that rsplit() starts splitting from the end of the string rather than from the beginning. Exampl 3 min read String Manipulation in R String manipulation is a process of handling and analyzing strings. It involves various operations of modification and parsing of strings to use and change its data. R offers a series of in-built functions to manipulate a string. In this article, we will study different functions concerned with the 4 min read Python String rpartition() Method String rpartition() method in Python is a powerful tool for splitting a string into three parts, based on the last occurrence of a specified separator. It provides an efficient way to handle text parsing when we want to divide strings from the rightmost delimiter. Let us start with a simple example: 4 min read Python | Pandas Reverse split strings into two List/Columns using str.rsplit() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas provide a method to split string around a passed separator or delimiter. After 4 min read Like