Posted on:

02 May 2022


I don't understand what is considered a column in a 2D array

In Question 13 in the last exam, we are supposed to find ptp for each column of array_a = [[12, 3, 4],[9, 10, -3],[8, 19, 25]]. which is normally just like np.mean, should be np.ptp(array_a, axis = 0). but the answer was the two other solutions (axis = 1 ), which from my understanding is the ptp in what I consider a row. array_a[:,0] return the first column which is [12, 9, 8], the ptp here is 4. array_a[0] returns the first row which is [12,3,4] and the ptp here is 9. Am I mixing rows and columns or is there a mistake in the question ?

0 answers ( 0 marked as helpful)

Submit an answer