0

It's strange I don't find anything on this. I want to concatenate 2 arrays that come from a bigger one.

For example :

first_array = []

second_array = [1, 2]

My desired outcome:

a = first_array + second_array = [1, 2]

It is a possible case of my problem and + operator leads to :

*** ValueError: operands could not be broadcast together with shapes (8042,) (0,)

extends and appends can't be computed either...

Any tips to accept to concatenate 2 array with an empty one ? Everything is working well in other cases with '+' op.

Thanks you :)

In this post : Concatenating two one-dimensional NumPy arrays they talk about concatenate but I would like to have another way to do this.

Alexy
  • 780
  • 6
  • 22

1 Answers1

2

If you are using normal lists it should work. Otherwise, if you're using numpy arrays, you can do this:

a = list(first_array)+list(second_array)
briwa
  • 46
  • 6