Combine all elements of two arrays python

I have two arrays, and want to combine the ith elements in each one together:

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

I want to return

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

What is the function for this? Thx,

Answers


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

@DSM makes the point that if a and b had dtype=object you could simply add the two arrays together:

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

Need Your Help

How to change enable to disable in Td?

jquery css

I have a question. I Have a table data

Issue Converting Over To GMaps v2 for Android

java android google-maps android-location

I'm trying to convert an old version of this code from GMaps v1.1 to GMaps v2. I am having issues converting the following MapController code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.