numpy.defchararray.add() in Python Last Updated : 28 Nov, 2018 Comments Improve Suggest changes Like Article Like Report 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', 'AAAttttds', 'AAaxtt'] arr2 = ['1111sfdsf', '1111111sdsf2', '1111111sfsf2'] print ("\narr1 : ", arr1) print ("\narr2 : ", arr2) print ("\narr1 + arr2\n", np.char.add(arr1, arr2)) print ("\narr2 + arr1\n", np.char.add(arr2, arr1)) Output: arr1 : ['vdteteAAAa', 'AAAttttds', 'AAaxtt'] arr2 : ['1111sfdsf', '1111111sdsf2', '1111111sfsf2'] arr1 + arr2 ['vdteteAAAa1111sfdsf' 'AAAttttds1111111sdsf2' 'AAaxtt1111111sfsf2'] arr2 + arr1 ['1111sfdsfvdteteAAAa' '1111111sdsf2AAAttttds' '1111111sfsf2AAaxtt'] Code #2: Python3 1== # Python Program illustrating # numpy.char.add() method import numpy as np arr1 = 'This is geeks ' arr2 = 'for geeks ' print ("\narr1 + arr2\n", np.char.add(arr1, arr2)) print ("\narr2 + arr1\n", np.char.add(arr2, arr1)) Output: arr1 + arr2 This is geeks for geeks arr2 + arr1 for geeks This is geeks Comment More infoAdvertise with us Next Article numpy.defchararray.add() in Python mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-String Operation Practice Tags : python Similar Reads 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.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.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.defchararray.multiply() in Python 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.m 1 min read Python | Numpy numpy.ndarray.__add__() With the help of Numpy numpy.ndarray.__add__(), we can add a particular value that is provided as a parameter in the ndarray.__add__() method. Value will be added to each and every element in a numpy array. Syntax: ndarray.__add__($self, value, /) Return: self+value Example #1 : In this example we c 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 Python | Numpy numpy.ndarray.__iadd__() With the help of numpy.ndarray.__iadd__() method, we can add a particular value that is provided as a parameter in the ndarray.__iadd__() method. Value will be added to every element in a numpy array. Syntax: ndarray.__iadd__($self, value, /) Return: self+=value Example #1 : In this example we can s 1 min read Python | Numpy MaskedArray.__add__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__add__ we can add a particular value that is provided as a parameter in the MaskedArray.__add__() method. Value will be added to each and every element i 1 min read Like