Skip to content

Commit 85dd52b

Browse files
committed
Add length checking for x in ∆∆
If the length of unique value of correspoding x column in the input data is not 2, force the delta2 argument to be False to avoid incomplete ∆∆ plots
1 parent 7eb5a99 commit 85dd52b

2 files changed

Lines changed: 210 additions & 33 deletions

File tree

dabest/_classes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ def __init__(self, data, idx, x, y, paired, id_col, ci,
149149

150150
# create new x & idx and record the second variable if this is a valid 2x2 ANOVA case
151151
if idx is None and x is not None and y is not None:
152+
# Add a length check for unique values in the first element in list x,
153+
# if the length is greater than 2, force delta2 to be False
154+
if len(data_in[x[0]].unique()) > 2:
155+
delta2 = False
156+
self.__delta2 = delta2
157+
# stop the loop if delta2 is False
158+
152159
# add a new column which is a combination of experiment and the first variable
153160
new_col_name = experiment+x[0]
154161
while new_col_name in data_in.columns:

0 commit comments

Comments
 (0)