How to access specific row of multidimensional NumPy array with different dimension?

Viewed 2910

I have a NumPy array with two dimensions so that first array are numbers from 1 to 50 and second 50 to 150:

a =numpy.array([[1,2,3,...,50],[50,51,52...,150]]).

I want to print only specified row for example second row by means of

print(a[1,:]),

to get [50,51,52...,150] however it shows

    print((a[1,:]))
IndexError: too many indices for array  

error. When I reduced second row to the same number of elements as the first one, it works. So, the problem is printing specified row with different dimension. If possible, could you tell how to deal with this, please ? Thanks!

2 Answers
Related