|
127 | 127 | " self._check_errors(x, y, idx, experiment, experiment_label, x1_level)\n", |
128 | 128 | " \n", |
129 | 129 | "\n", |
| 130 | + " # Check if there is NaN under any of the paired settings\n", |
| 131 | + " if self.__is_paired and self.__output_data.isnull().values.any():\n", |
| 132 | + " import warnings\n", |
| 133 | + " warn1 = f\"NaN values detected under paired setting and removed,\"\n", |
| 134 | + " warn2 = f\" please check your data.\"\n", |
| 135 | + " warnings.warn(warn1 + warn2)\n", |
| 136 | + " if x is not None and y is not None:\n", |
| 137 | + " rmname = self.__output_data[self.__output_data[y].isnull()][self.__id_col].tolist()\n", |
| 138 | + " self.__output_data = self.__output_data[~self.__output_data[self.__id_col].isin(rmname)]\n", |
| 139 | + " elif x is None and y is None:\n", |
| 140 | + " self.__output_data.dropna(inplace=True)\n", |
| 141 | + "\n", |
130 | 142 | " # create new x & idx and record the second variable if this is a valid 2x2 ANOVA case\n", |
131 | 143 | " if idx is None and x is not None and y is not None:\n", |
132 | 144 | " # Add a length check for unique values in the first element in list x,\n", |
|
632 | 644 | " \"\"\"\n", |
633 | 645 | " Function to prepare some attributes for plotting\n", |
634 | 646 | " \"\"\"\n", |
635 | | - "\n", |
| 647 | + " # Check if there is NaN under any of the paired settings\n", |
| 648 | + " if self.__is_paired is not None and self.__output_data.isnull().values.any():\n", |
| 649 | + " print(\"Nan\")\n", |
| 650 | + " import warnings\n", |
| 651 | + " warn1 = f\"NaN values detected under paired setting and removed,\"\n", |
| 652 | + " warn2 = f\" please check your data.\"\n", |
| 653 | + " warnings.warn(warn1 + warn2)\n", |
| 654 | + " rmname = self.__output_data[self.__output_data[y].isnull()][self.__id_col].tolist()\n", |
| 655 | + " self.__output_data = self.__output_data[~self.__output_data[self.__id_col].isin(rmname)]\n", |
| 656 | + " \n", |
636 | 657 | " # Identify the type of data that was passed in.\n", |
637 | 658 | " if x is not None and y is not None:\n", |
638 | 659 | " # Assume we have a long dataset.\n", |
|
676 | 697 | " self.__xvar = \"group\"\n", |
677 | 698 | " self.__yvar = \"value\"\n", |
678 | 699 | "\n", |
| 700 | + " # Check if there is NaN under any of the paired settings\n", |
| 701 | + " if self.__is_paired is not None and self.__output_data.isnull().values.any():\n", |
| 702 | + " import warnings\n", |
| 703 | + " warn1 = f\"NaN values detected under paired setting and removed,\"\n", |
| 704 | + " warn2 = f\" please check your data.\"\n", |
| 705 | + " warnings.warn(warn1 + warn2)\n", |
| 706 | + "\n", |
679 | 707 | " # First, check we have all columns in the dataset.\n", |
680 | 708 | " for g in all_plot_groups:\n", |
681 | 709 | " if g not in self.__output_data.columns:\n", |
|
695 | 723 | " var_name=self.__xvar,\n", |
696 | 724 | " )\n", |
697 | 725 | "\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", |
702 | 726 | " # Added in v0.2.7.\n", |
703 | 727 | " plot_data.dropna(axis=0, how=\"any\", subset=[self.__yvar], inplace=True)\n", |
704 | 728 | "\n", |
|
0 commit comments