The numpy.char.rsplit() function in Python is used to return a list of words in the string of an array of strings using a sep as the delimiter string.
char.rsplit(a, sep=None)
The numpy.char.rsplit() function takes the following parameter values:
a: This is the input array of strings or Unicode.sep: This is the delimiter string or the separator. If this value is not specified, then a whitespace string is used as a separator.maxsplit: This represents the maximum split that can be done. This parameter value is optional.The numpy.char.rsplit() function returns an array of list objects.
import numpy as np# creating an input arraya = np.array(['Artery', 'Material', 'Arterial'])myarray= np.char.rsplit(a, sep ="er")print(myarray)
numpy module.a, using the array() function.char.rsplit() function on the array a and assign the result to a variable called myarray.myarray.