numpy string operations | translate() function Last Updated : 29 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report numpy.core.defchararray.translate(arr, table, deletechars=None) is another function for doing string operations in numpy. For each element in arr, it returns a copy of the string where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table. If there are more than one values to be translated, a dictionary is passed to maketrans function to create a translation table. Parameters: arr : array_like of str or unicode.Input array. table : Translate mapping specified to perform translations. deletechars : String type, characters to be deleted. Returns : [ndarray] Output array of str or unicode with translated values. Code #1 : Python3 # Python program explaining # numpy.core.defchararray.translate() method # importing numpy import numpy as geek # input array in_arr = geek.array(['Weeks', 'our', 'Weeks']) print ("Input original array : ", in_arr) # creating dictionary for translation table trans_dict ={"W": "G", "o": "f", "u": "o"} # creating translation table from dictionary trans_table ="Wou".maketrans(trans_dict) out_arr = geek.core.defchararray.translate(in_arr, trans_table, deletechars ="None") print ("Output translated array: ", out_arr) Output: Input original array : ['Weeks' 'our' 'Weeks'] Output translated array: ['Geeks' 'for' 'Geeks'] Comment More infoAdvertise with us Next Article numpy string operations | translate() function J jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads numpy string operations | title() function numpy.core.defchararray.title(arr): function is used to Return element-wise title cased version of string or unicode.Title case words start with uppercase characters, all remaining cased characters are lowercase. Parameters: arr : [ array_like ] Input array which may be str or unicode. Returns : [nd 1 min read numpy string operations | strip() function numpy.core.defchararray.strip(arr, chars=None) is another function for doing string operations in numpy. It returns a copy with the leading and trailing characters removed for each element in arr. Parameters: arr : array_like of str or unicode. char : [str or unicode, optional] the set of characters 2 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 | 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 | upper() function numpy.core.defchararray.upper(arr): function is used to return an array with the elements converted to uppercase. Parameters: arr : [ array_like ] Input array which may be str or unicode. Returns : [ndarray] Output uppercased array of str or unicode, depending on input type. Code #1: Python3 # Pytho 1 min read Like