When you used np.invert it would select all the elements of Train_x, with ~ it should select only the elements that match the condition.
You can check how many elements match the inverted condition using
inverted = ~locs
print("Percent matching elements", 100. * inverted.sum().float() / inverted.numel())