webermarcolivier / statannot

add statistical annotations (pvalue significance) on an existing boxplot generated by seaborn boxplot
MIT License
393 stars 74 forks source link

p-value and stats returning 'nan' except for Mann-Whitney test #61

Open lucindasisk opened 3 years ago

lucindasisk commented 3 years ago

Hi! I am attempting to use add_stat_annotation to add t-test statistics for group differences to a bar plot, but keep getting 'nan' for the returned p and t values. I have resorted to using the scipy t-test_ind function to compute these prior and add them using add_stat_annot manually, but would be great to know if there is a way to fix this! I also tried out the other available tests, and got nans for all except the Mann-Whitney test. Of note, my x variable is a categorical variable containing 1s, 2s, and 3s, and my y variable is a continuous variable with no 0s or nans. Thanks for any insight!

trevismd commented 3 years ago

I know it's late, but would you be willing to show minimal data that leads to this situation, as well as your specific calls to barplot and add_stat_annotation?