Skip to content

Commit c849aca

Browse files
committed
Fix pandas problem
1 parent e5fbe1e commit c849aca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dabest/_dabest_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
# Determine the kind of estimation plot we need to produce.
113113
if all([isinstance(i, (str, int, float)) for i in idx]):
114114
# flatten out idx.
115-
all_plot_groups = pd.unique(pd.Series(idx)).tolist()
115+
all_plot_groups = pd.Series([t for t in idx]).unique().tolist()
116116
if len(idx) > len(all_plot_groups):
117117
err0 = "`idx` contains duplicated groups. Please remove any duplicates and try again."
118118
raise ValueError(err0)
@@ -122,7 +122,7 @@ def __init__(
122122
self.__idx = (idx,)
123123

124124
elif all([isinstance(i, (tuple, list)) for i in idx]):
125-
all_plot_groups = pd.unique(pd.Series([tt for t in idx for tt in t])).tolist()
125+
all_plot_groups = pd.Series([tt for t in idx for tt in t]).unique().tolist()
126126

127127
actual_groups_given = sum([len(i) for i in idx])
128128

nbs/API/dabest_object.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
" # Determine the kind of estimation plot we need to produce.\n",
181181
" if all([isinstance(i, (str, int, float)) for i in idx]):\n",
182182
" # flatten out idx.\n",
183-
" all_plot_groups = pd.unique(pd.Series(idx)).tolist()\n",
183+
" all_plot_groups = pd.Series([t for t in idx]).unique().tolist()\n",
184184
" if len(idx) > len(all_plot_groups):\n",
185185
" err0 = \"`idx` contains duplicated groups. Please remove any duplicates and try again.\"\n",
186186
" raise ValueError(err0)\n",
@@ -190,7 +190,7 @@
190190
" self.__idx = (idx,)\n",
191191
"\n",
192192
" elif all([isinstance(i, (tuple, list)) for i in idx]):\n",
193-
" all_plot_groups = pd.unique(pd.Series([tt for t in idx for tt in t])).tolist()\n",
193+
" all_plot_groups = pd.Series([tt for t in idx for tt in t]).unique().tolist()\n",
194194
"\n",
195195
" actual_groups_given = sum([len(i) for i in idx])\n",
196196
"\n",

0 commit comments

Comments
 (0)