在 numpy 数组上使用布尔运算的可见弃用警告

Visible deprecation warning using boolean operation on numpy array

我遇到了一个问题,我不断收到一条警告:

VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; 
dimension is 744 but corresponding boolean dimension is 1

当我尝试使用它时:

x_low = xcontacts[(xcontacts[5:6] <= 2000).any(1), :]
x_med = xcontacts[(xcontacts[5:6] <= 4000).any(1), :]
x_med = xcontacts[(xcontacts[5:6] > 2000).any(1), :]
x_hi  = xcontacts[(xcontacts[5:6] > 4000).any(1), :]

在形状数组上:

xcontacts.shape
Out[46]: (744L, 6L)

这是数组的示例:

[[   1.        0.        0.        4.        0.      228.681 ]
 [   2.        4.        0.        8.        0.      219.145 ]
 [   3.        8.        0.       12.        0.      450.269 ]
 ..., 
 [  60.      236.       96.      240.       96.      933.4565]
 [  61.      240.       96.      244.       96.      646.449 ]
 [  62.      244.       96.      248.       96.      533.657 ]]

我正在尝试创建三个新数组,它们是第一个数组的副本,但在对最后一列执行布尔运算后,删除了与运算符不一致的行:

x_low where col5 <= 2000
x_med where 2000 < col5 <= 4000
x_hi where 4000 < col5

有人知道我做错了什么吗?

感谢@Syrtis Major:

x_low = xcontacts[(xcontacts[:,5] <= 2000)]
x_med = xcontacts[(xcontacts[:,5] <= 4000)]
x_med = xcontacts[(xcontacts[:,5] > 2000)]
x_hi  = xcontacts[(xcontacts[:,5] > 4000)]