fork download
  1. import numpy
  2.  
  3. x = numpy.array([[1], [2], [3]])
  4. y = numpy.array([4, 5])
  5. i = ([1, 2], 0)
  6.  
  7. print(x[i].shape)
  8. print(y.shape)
  9.  
  10. x[i] = y
  11.  
  12. print(repr(x))
Success #stdin #stdout 0.09s 92608KB
stdin
Standard input is empty
stdout
(2,)
(2,)
array([[1],
       [4],
       [5]])