Keep finite entries only in Pandas
df[np.isfinite(df) | np.isnan(df)]
You can use:
with pd.option_context('mode.use_inf_as_null', True):
df = df.dropna()
df[np.isfinite(df) | np.isnan(df)]
You can use:
with pd.option_context('mode.use_inf_as_null', True):
df = df.dropna()