Skip to content

Commit

Permalink
rm bare exception
Browse files Browse the repository at this point in the history
  • Loading branch information
tompollard committed Nov 15, 2019
1 parent b5ef036 commit d3625a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tableone.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,16 @@ def _tukey(self, x, threshold):
k = 3.0 indicates an outlier that is "far out"
"""
vals = x.values[~np.isnan(x.values)]

try:
q1, q3 = np.percentile(vals, [25, 75])
iqr = q3 - q1
low_bound = q1 - (iqr * threshold)
high_bound = q3 + (iqr * threshold)
outliers = np.where((vals > high_bound) | (vals < low_bound))
except:
except IndexError:
outliers = []

return outliers

def _outliers(self, x):
Expand Down

0 comments on commit d3625a9

Please sign in to comment.