numpy.defchararray.multiply() in Python Last Updated : 30 Jun, 2020 Comments Improve Suggest changes Like Article Like Report numpy.core.defchararray.multiply(arr, n): Concatenates strings 'n' times element-wise. Parameters: arr : array-like or string. n : [array-like] no. of times we want to concatenate. Returns : Concatenated String 'n' times element-wise. Code #1: Python3 1== # Python Program illustrating # numpy.char.multiply() method import numpy as np arr1 = ['eAAAa', 'ttttds', 'AAt'] arr2 = ['11sf', 'sdsf2', '1111f2'] print ("\narr1 : ", arr1) print ("\narr2 : ", arr2) print ("\narr1 : ", np.char.multiply(arr1, 2)) # Separate multiplication print ("\narr1 : ", np.char.multiply(arr1, [2, 4, 3])) print ("\narr2 : ", np.char.multiply(arr2, 3)) Output: arr1 : ['eAAAa', 'ttttds', 'AAt'] arr2 : ['11sf', 'sdsf2', '1111f2'] arr1 : ['eAAAaeAAAa' 'ttttdsttttds' 'AAtAAt'] arr1 : ['eAAAaeAAAa' 'ttttdsttttdsttttdsttttds' 'AAtAAtAAt'] arr2 : ['11sf11sf11sf' 'sdsf2sdsf2sdsf2' '1111f21111f21111f2'] Code #2: Python3 1== # Python Program illustrating # numpy.char.multiply() method import numpy as np arr1 = 'This is geeks ' arr2 = 'for geeks ' print ("\narr1 : ", np.char.multiply(arr1, 2)) print ("\narr2 : ", np.char.multiply(arr2, 4)) Output: arr1 : This is geeks arr2 : for geeks arr1 : This is geeks This is geeks arr2 : for geeks for geeks for geeks for geeks Comment More infoAdvertise with us Next Article numpy.defchararray.multiply() in Python mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads numpy.defchararray.add() in Python numpy.core.defchararray.add(arr1, arr2): Concatenates two strings element-wise. Parameters: arr1 : array-like or string. arr2 : array-like or string. Returns : Concatenates String. Code #1: Python3 1== # Python Program illustrating # numpy.char.add() method import numpy as np arr1 = ['vdteteAAAa', ' 1 min read numpy.defchararray.encode() in Python numpy.core.defchararray.encode(arr, encoding): This numpy function encodes the string(object) based on the specified codec. Parameters: arr : array-like or string. encoding : [str] Name of encoding being followed. error : Specifying how to handle error. Returns : Encoded string Code: Python3 # Pyth 1 min read numpy.multiply() in Python The numpy.multiply() is a numpy function in Python which is used to find element-wise multiplication of two arrays or scalar (single value). It returns the product of two input array element by element.Syntax:numpy.multiply(arr1, arr2, out=None, where=True, casting='same_kind', order='K', dtype=None 3 min read numpy.defchararray.decode() in Python numpy.core.defchararray.decode(arr, encoding): This numpy function decode the string(object) based on the specified codec. Parameters: arr : array-like or string. encoding : [str] Name of codec being followed. error : Specifying how to handle error. Returns : Decoded string Code: Python3 1== # Pytho 1 min read numpy.defchararray.center() in Python numpy.core.defchararray.center(arr, width, fillchar): Centers the element of the string element-wise. Parameters: arr : array-like or string. width : Length of resulting string. fillchar : Padding character. Default is space.Returns : Copy of array with centered string. Code #1:  Python3 # Python 1 min read numpy.char.multiply() function in Python The multiply() method of the char class in the NumPy module is used for element-wise string multiple concatenation. numpy.char.multiply()Syntax : numpy.char.multiply(a, i)Parameters : a : array of str or unicodei : number of times to be repeatedReturns : Array of strings Example 1 : Using the method 1 min read numpy.defchararray.capitalize() in Python numpy.core.defchararray.multiply(arr, n): Capitalizes the first letter of string element-wise. Parameters: arr : array-like or string. Returns : Capitalized first letter of the string. Code #1: Python3 1== # Python Program illustrating # numpy.char.capitalize() method import numpy as np arr1 = ['eAA 1 min read numpy.asarray() in Python numpy.asarray()function is used when we want to convert input to an array. Input can be lists, lists of tuples, tuples, tuples of tuples, tuples of lists and arrays. Syntax : numpy.asarray(arr, dtype=None, order=None) Parameters : arr : [array_like] Input data, in any form that can be converted to a 2 min read NumPy Array in Python NumPy (Numerical Python) is a powerful library for numerical computations in Python. It is commonly referred to multidimensional container that holds the same data type. It is the core data structure of the NumPy library and is optimized for numerical and scientific computation in Python. Table of C 2 min read numpy.asfarray() in Python numpy.asfarray()function is used when we want to convert input to a float type array. Input includes scalar, lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays. Syntax : numpy.asfarray(arr, dtype=type 'numpy.float64') Parameters : arr : [array_like] Input data, in any for 2 min read Like