arr_2d = np.array([[11, 20, 13],[14, 25, 16],[27, 18, 9]]) print(arr_2d[1, :1])
时间: 2023-11-30 19:11:43 浏览: 105
numpy-numpy教程之Arrays的创建.zip
The output of the code is:
[14]
Explanation:
- The code creates a 2-dimensional NumPy array called `arr_2d`.
- `arr_2d` has 3 rows and 3 columns, and contains the values [[11, 20, 13],[14, 25, 16],[27, 18, 9]].
- The code then selects the second row of `arr_2d` (which has an index of 1), and the first column of that row (which has an index of 0).
- The selected value is 14, which is a single element array.
- The output of the code is the selected value, which is [14].
阅读全文