Korean_Of_the_Mountain
Korean_Of_the_Mountain

Reputation: 1577

different methods indexing numpy arrays

If I have an NxN NumPy array, and I wanted to get all rows of data from just the 5th column, is there any difference between the following methods:

just_the_fifth_a = somearray[0::,4]

just_the_fifth_b = somearray[0:,4]

just_the_fifth_c = somearray[:,4]

Upvotes: 1

Views: 35

Answers (1)

Philipp Braun
Philipp Braun

Reputation: 1573

No there is no difference between the three posted methods. You could do somearray[::,4] as well.

Upvotes: 1

Related Questions