更新时间:2022-12-10 19:27:09
如果数组arr
的长度可被3整除,则为
If your array arr
has a length divisible by 3:
np.mean(arr.reshape(-1, 3), axis=1)
重塑为高维数组,然后对其中一个附加维执行某种形式的归约运算是numpy编程的主要内容.
Reshaping to a higher dimensional array and then performing some form of reduce operation on one of the additional dimensions is a staple of numpy programming.