how to substitute a dataframe code example
Example 1: pandas dataframe replace inf
df.replace([np.inf, -np.inf], np.nan)
Example 2: replace values of pandas column
df.loc[df['column'] == 'column_value', 'column'] = 'new_column_value'
df.replace([np.inf, -np.inf], np.nan)
df.loc[df['column'] == 'column_value', 'column'] = 'new_column_value'