Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created December 22, 2021 03:30
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 quantra-go-algo/06abdf4f7c4bc20d6e20e418cfb77e85 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/06abdf4f7c4bc20d6e20e418cfb77e85 to your computer and use it in GitHub Desktop.
#For identifying the outliers with the standard deviation method
outliers = [x for x in data if x < lower or x > upper]
print('Identified outliers: %d' % len(outliers))
#Remove outliers
outliers_removed = [x for x in data if x >= lower and x <= upper]
print('Non-outlier observations: %d' % len(outliers_removed))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment