Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 27, 2020 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/66e2d3d44518d09ad0646264abccecf7 to your computer and use it in GitHub Desktop.
Save amankharwal/66e2d3d44518d09ad0646264abccecf7 to your computer and use it in GitHub Desktop.
fig, axes = plt.subplots(1, 2, figsize=(20,8),)
fig.suptitle('Before and After Manually removing outliers')
axes[0].set_title('Before')
axes[1].set_title('After')
g = sns.regplot(x=train['GrLivArea'], y=train['SalePrice'], ax = axes[0])
g.text(4500, 400000, "Outliers", horizontalalignment='left', size='large', color='black', weight='semibold')
g.axvline(4000, ls='--', color = 'red')
idx_manual = np.where(train['GrLivArea']>4000)[0]
train_NoOutlier = train.drop(idx_manual)
g = sns.regplot(x=train_NoOutlier['GrLivArea'], y=train_NoOutlier['SalePrice'], ax = axes[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment