I have a numpy array
A = np.array([[1, 2, 3, 4],
[2, float('inf'), 3, 4],
[5, 6, 7, 8]])
I would like to remove the lines that contain an infinite value in them so that the results would be
np.array([[1,2,3,4],
[5,6,7,8]])
I tried to do A = A[float('inf') not in A], but the result is array([], shape=(0, 3, 4), dtype=float64).
I could do
B = []
for line in A:
if float('inf') not in line:
B.append(line)
A = np.array(B)
but is there a better way to do this?