Last active
August 6, 2020 17:46
-
-
Save ShrashtiSinghal/0eb73ab620be685575d7017ff3ff1e65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Find Percentage of outliers in every column | |
for k, v in data.items(): | |
q1 = v.quantile(0.25) | |
q3 = v.quantile(0.75) | |
IQR = q3 - q1 | |
v_col = v[(v <= q1 - 1.5 * IQR) | (v >= q3 + 1.5 * IQR)] | |
percentage = np.shape(v_col)[0] * 100.0 / np.shape(data)[0] | |
print("Column %s outliers = %.2f%%" % (k, percentage)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment