I have two numpy array's a and b of length 53 and 82 respectively. I would like to merge them into a single array because I want to use the 53+82=135 length array say call it c for plotting.
I tried
c = a+b
but I am getting ValueError: shape mismatch: objects cannot be broadcast to a single shape
Is this possible?
You need to use numpy.concatenate instead of array addition
c = numpy.concatenate((a, b))
Implementation
import numpy as np
a = np.arange(53)
b = np.arange(82)
c = np.concatenate((a, b))
Output
c.shape
(135, )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With