Skip to content

Commit

Permalink
all tests pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
paddymul committed Nov 23, 2023
1 parent 08a6a06 commit cb954ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions buckaroo/customizations/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ def series_summary(sampled_ser, ser):
if pd.api.types.is_bool_dtype(ser):
return dict(histogram_args={})
vals = ser.dropna()
low_tail = np.quantile(ser, 0.01)
high_tail = np.quantile(ser, 0.99)
if len(vals) == 0:
return dict(histogram_args={})
low_tail = np.quantile(vals, 0.01)
high_tail = np.quantile(vals, 0.99)
low_pass = ser > low_tail
high_pass = ser < high_tail
meat = vals[low_pass & high_pass]
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/analysis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,23 @@ def test_perverse_on_histogram():
nan_per=0
))

def test_perverse_on_histogram2():

series_result = Histogram.series_summary(
PERVERSE_DF['UInt8None'], PERVERSE_DF['UInt8None'])
assert series_result == {'histogram_args':{}}
summary_result = Histogram.computed_summary(
dict(histogram_args={},
length=10,
value_counts=pd.Series(
[10],
index=[False]),
min=False,
max=False,
is_numeric=True,
nan_per=0
))




Expand Down

0 comments on commit cb954ae

Please sign in to comment.