假设已执行语句import numpy as np和c = np.arange(25).reshape(5,5),那么表达式c[[2,4], 3:].sum()的值为__。
举一反三
- 如下代码的输出结果是( )import numpy as npa = np.arange(12).reshape(3, 4)print(np.sum(a[[0, 2], 2:]))
- 如下代码的输出结果是( )import numpy as npa = np.arange(12).reshape(3, 4)print(np.sum(a[1:, 2:]))
- 有如下语句:import numpy as npA=np.arange(12) .reshape(3,4)则A[1]的值是[0,1,2,3]
- 请在下面空格处填写答案(两行结果中间用一个半角分号分隔)。>>> import numpy as np >>> a = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)]) >>> a.shape (______) >>> a[[2]].sum() _______
- ndarray对象实例a,代码如下:import numpy as np a = np.array([[0, 1, 2, 3, 4], [9, 8, 7, 6, 5]])a.itemsize的执行结果是什么? A: 32 B: 2 C: 4 D: 10