Skip to content

Instantly share code, notes, and snippets.

@SajidLhessani
Created September 6, 2021 01:22
Show Gist options
  • Save SajidLhessani/6ae7716349c4202aafb9b0883b7b0881 to your computer and use it in GitHub Desktop.
Save SajidLhessani/6ae7716349c4202aafb9b0883b7b0881 to your computer and use it in GitHub Desktop.
# Change the value of 'Corr' to -1 if it is less than -1
df.loc[df['Corr'] < -1, 'Corr'] = -1
# Change the value of 'Corr' to 1 if it is greater than 1
df.loc[df['Corr'] > 1, 'Corr'] = 1
# Drop the NaN values
df = df.dropna()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment