Skip to content

Commit 91ff9be

Browse files
committed
Prevent deprecation warning for pandas
1 parent 2fc8052 commit 91ff9be

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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([t for t in idx]).tolist()
115+
all_plot_groups = pd.unique(pd.Series([t for t in idx])).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([tt for t in idx for tt in t]).tolist()
125+
all_plot_groups = pd.unique(pd.Series([tt for t in idx for tt in t])).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([t for t in idx]).tolist()\n",
183+
" all_plot_groups = pd.unique(pd.Series([t for t in idx])).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([tt for t in idx for tt in t]).tolist()\n",
193+
" all_plot_groups = pd.unique(pd.Series([tt for t in idx for tt in t])).tolist()\n",
194194
"\n",
195195
" actual_groups_given = sum([len(i) for i in idx])\n",
196196
"\n",

0 commit comments

Comments
 (0)