numpy:arr [True]创建一个新轴

时间:2018-05-04 12:41:44

标签: python numpy numpy-indexing

我不明白为什么True不像布尔掩码那样:

>>> x = np.arange(5)
>>> x[(x<3) & True].shape
(3,)
>>> x[np.repeat(True, 5)].shape
(5,)
>>> x[True].shape
(1, 5)

0 个答案:

没有答案