1

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

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

0 回答 0