df = df[df['my_var'].notna()]
x = x[numpy.logical_not(numpy.isnan(x))]
df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)