Apr-01-2020, 01:10 PM
(Apr-01-2020, 04:35 AM)perfringo Wrote: The problem is exactly described in error message: you can't broadcast shape 2,1 into shape 2.But it obviously doesn't describe a solution, and a ton of research hasn't led me any nearer on a solution.
(Apr-01-2020, 04:35 AM)perfringo Wrote: Before any advice it would be good to know what is the objective i.e. what do you want to accomplish.The exact same result that I said I got in the first post, but without having to do it one by one. It's fine with an array of a size 2, but what if I had a size 10, 1000 or even higher? Then part of my code would look like this:
a[0]=b[0] a[1]=b[1] a[2]=b[2] a[3]=b[3] a[4]=b[4] a[5]=b[5] ... a[997]=b[997] a[998]=b[998] a[999]=b[999]But there must be an easier way of doing this, using slicing, or list comprehension perhaps. And that's what I can't figure out how to do.