如下代码的输出是( )import numpy as npa = np.arange(6).reshape(3, 2)b = a.sum(axis=0)c = b.sum(axis=0)
举一反三
- 以下代码的运行结果是( )。import numpy as np a=np.arange(8).reshape(2,4) s=a.sum(axis=0) print(s) A: [6 22] B: 28 C: 36 D: [4 6 8 10]
- 如下代码的输出结果是( )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:]))
- 找到二维数组np.arange(9).reshape(3,3)每一行中的最大值的代码。[br][/br]import numpy as np[br][/br]array=np.arange(9).reshape(3,3)[br][/br]max_num= A: np.unique(array)[-1] B: np.unique(array)[:1] C: np.max(array, axis=0) D: np.max(array, axis=1)
- numpy求二维矩阵H每行的和: A: sum(axis=1) B: sum(axis=0) C: sum(axis=-1) D: sum()