Combine all elements of two arrays python -


i have 2 arrays, , want combine ith elements in each 1 together:

import numpy np = np.array(['a', 'b', 'c']) b = np.array(['x', 'y', 'z']) 

i want return

array(['ax', 'by', 'cz']) 

what function this? thx,

>>> import numpy np >>> = np.array(['a', 'b', 'c']) >>> b = np.array(['x', 'y', 'z']) >>> c = np.array([i+j i, j in zip(a, b)]) >>> c array(['ax', 'by', 'cz'],       dtype='|s2') 

@dsm makes point if a , b had dtype=object add 2 arrays together:

>>> = np.array(["a", "b", "c"], dtype=object) >>> b = np.array(["x", "y", "z"], dtype=object) >>> c = + b >>> c array([ax, by, cz], dtype=object) 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -