Skip to content

Commit 1b9d5ea

Browse files
committed
Generate Warnings for NaN values under paired
1 parent 746dc2b commit 1b9d5ea

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

dabest/_dabest_object.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from scipy.stats import norm
1111
from scipy.stats import randint
1212

13-
1413
# %% ../nbs/API/dabest_object.ipynb 6
1514
class Dabest(object):
1615

@@ -626,6 +625,10 @@ def _get_plot_data(self, x, y, all_plot_groups):
626625
var_name=self.__xvar,
627626
)
628627

628+
if self.__is_paired is not None and plot_data.isnull().values.any():
629+
import warnings
630+
warnings.warn("NaN values detected in paired setting, please remove NaNs and corresponding rows before proceeding.")
631+
629632
# Added in v0.2.7.
630633
plot_data.dropna(axis=0, how="any", subset=[self.__yvar], inplace=True)
631634

nbs/API/dabest_object.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"from numpy import array, repeat, random, issubdtype, number\n",
6060
"import pandas as pd\n",
6161
"from scipy.stats import norm\n",
62-
"from scipy.stats import randint\n"
62+
"from scipy.stats import randint"
6363
]
6464
},
6565
{
@@ -695,6 +695,10 @@
695695
" var_name=self.__xvar,\n",
696696
" )\n",
697697
"\n",
698+
" if self.__is_paired is not None and plot_data.isnull().values.any():\n",
699+
" import warnings\n",
700+
" warnings.warn(\"NaN values detected in paired setting, please remove NaNs and corresponding rows before proceeding.\")\n",
701+
"\n",
698702
" # Added in v0.2.7.\n",
699703
" plot_data.dropna(axis=0, how=\"any\", subset=[self.__yvar], inplace=True)\n",
700704
"\n",

0 commit comments

Comments
 (0)