Remova Nans e INFS Python
x = x[numpy.logical_not(numpy.isnan(x))]
Fantastic Fly
x = x[numpy.logical_not(numpy.isnan(x))]
df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)