how to find and replace entire df pandas code example Example: pandas dataframe replace inf df.replace([np.inf, -np.inf], np.nan)