The char.add()
function in Python is simply used to return an element-wise string concatenation of two arrays, str
, or Unicode.
char.add(x1, x2)
The char.add()
function takes the following mandatory parameter values.
x1
: This represents the input array.x2
: This represents the second input array to be concatenated with the first input array.The char.add()
function returns an array of strins or unicodes.
import numpy as np# creatin the arraysx1 = ['Hi', 'Welcome', 'board']x2 = ['Pals', 'on', '!']# implementing the char.add() methodmyarray = np.char.add(x1, x2)print(myarray)
numpy
module.x1
and x2
.char.add()
function to concatenate the arrays, x1
and x2
. The result is assigned to a variable myarray
.myarray
.