drop nan from ndarra code example
Example 1: remove nana from np array
x = x[~numpy.isnan(x)]
Example 2: remove nans and infs python
df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)
x = x[~numpy.isnan(x)]
df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)