drop nan and inf pandas code example
Example 1: drop if nan in column pandas
df = df[df['EPS'].notna()]
Example 2: pandas dataframe replace inf
df.replace([np.inf, -np.inf], np.nan)
Example 3: python remove nan rows
df = df[df['my_var'].notna()]