📜  python 获取二维数组中的平均列表 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:17.275000             🧑  作者: Mango

代码示例1
import numpy as np
a = [[1,2],[3,4]]
np.mean(a) # (1+2+3+4)/4 = 2.5
np.mean(a, axis=0) # [mean(1,3), mean(2,4)] = [2.0, 3.0]
np.mean(a, axis=1) # [mean(1,2), mean(3,4)] = [1.5, 2.5]