如何使用numpy广播重新编写这个python循环?你知道吗
>>> values.shape
(50000,)
>>> tests.shape # booleans
(200, 50000)
>>> extracted = values[tests]
# FAILES
>>> extracted = values[test] for test in tests]
>>> extracted.shape
(200,)
>>> extracted[0].shape
(33,)
>>> extracted[1].shape
(468,)
花哨/布尔索引在这里不起作用。你知道吗
这样怎么样? 如果您只想快速获得每行的大小。你知道吗
相关问题 更多 >
编程相关推荐