How can I fill the numpy array by rows?
For example arr=np.zeros([3,2]).
I want replace every row by list = [1,2].
So output is:
[1 2
1 2
1 2]
I can make it by hand
for x in arr[:]:
arr[:]=[1,2]
But I believe there is more faster ways.
Sorry, please look edit: Suppose, we have:
arr=array([[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]]])
I want arr[1] array fill by [1,2] like this:
arr=array([[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 1., 1., 1.],
[ 2., 2., 2.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]]])