replace function in python 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'
Example 3: replace one row with another in python
df.loc[(df.Event == 'Dance'),'Event']='Hip-Hop'
df