check dataframe for inf code example
Example 1: python check if is pandas dataframe
import pandas as pd
isinstance(df, pd.DataFrame)
Example 2: pandas dataframe replace inf
df.replace([np.inf, -np.inf], np.nan)
Example 3: check if dataframe contains infinity
df.replace([np.inf, -np.inf], np.nan).dropna(subset=["col1", "col2"], how="all")