For C1_W1_4.2the Slicing , why i got error like this


sliced_two_dim_cols = two_dim[:,3]
print(sliced_two_dim_cols)

IndexError Traceback (most recent call last)
in
----> 1 sliced_two_dim_cols = two_dim[:,3]
2 print(sliced_two_dim_cols)

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

1 Like

“two_dim” is a size (3x3) matrix.
This means the valid range for indices is 0 to 2.

1 Like