有人可以向我解释numpy python中的shape函数吗? [关闭]

问题描述 投票:-2回答:1

括号中的x做什么,方框中的0做什么?我想了解此形状函数的含义。谢谢您的帮助。

answer=np.sum(calculation)/np.shape(x)[0]
python numpy shapes
1个回答
0
投票

顾名思义,方法np.shape(x)返回numpy数组的形状。

假设x的形状是(10,30)。

然后np.shape(x)[0]为10,而np.shape(x)[1]为30。

© www.soinside.com 2019 - 2024. All rights reserved.