The front row and the back row are the columns.
Slicing 0:2 columns in row 0:2
lst = [
[1,2,3],
[4,5,6],
[7,8,9]
]
arr = np.array(lst)
The first subscript is for a row.
arr[0] only slices the first row. [1 2 3]
arr[0:2] slices to the second row. [[1 2 3] [4 5 6]]
The last subscript is about heat.
arr[0, 0:2] Slice only two columns in the first row. [1 2]
arr[0:2, 0:2] slices two columns in two rows. [[1 2] [4 5]]
© 2024 OneMinuteCode. All rights reserved.