1

arr = [12345, 12345, 12345, 12345] paths = [67890, 67890, 67890, 67890]

How can I combine these two numpy arrays to get this output below? output = [1234567890, 1234567890, 1234567890, 1234567890]

1

1 Answer 1

1

IIUC, here's one way:

arr_list = [arr, paths]
result = np.apply_along_axis(''.join, 0, arr_list)
Sign up to request clarification or add additional context in comments.

3 Comments

I suspect a list comprehension with zip will be faster.
I also thought of it. But, I've not compared performance @hpaulj
numpy.char.add(arr,path) could be another option, maybe it is easier to read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.