@@ -415,9 +415,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
415415
416416 else :
417417 # Plot the raw data as a barplot.
418- df_new = plot_data .copy ()
419- bar1_df = df_new .groupby (xvar ).count ().reset_index ()
420- bar1_df ['proportion' ] = [i / j for i , j in zip (bar1_df [yvar ], bar1_df [yvar ])]
418+ bar1_df = pd .DataFrame ({xvar : all_plot_groups , 'proportion' : np .ones (len (all_plot_groups ))})
421419 bar1 = sns .barplot (data = bar1_df , x = xvar , y = "proportion" ,
422420 ax = rawdata_axes ,
423421 order = all_plot_groups ,
@@ -466,9 +464,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
466464 ** swarmplot_kwargs )
467465 else :
468466 # Plot the raw data as a barplot.
469- df_new = plot_data .copy ()
470- bar1_df = df_new .groupby (xvar ).count ().reset_index ()
471- bar1_df ['proportion' ] = [i / j for i , j in zip (bar1_df [yvar ], bar1_df [yvar ])]
467+ bar1_df = pd .DataFrame ({xvar : all_plot_groups , 'proportion' : np .ones (len (all_plot_groups ))})
472468 bar1 = sns .barplot (data = bar1_df , x = xvar , y = "proportion" ,
473469 ax = rawdata_axes ,
474470 order = all_plot_groups ,
@@ -720,9 +716,9 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
720716 # Check that the effect size is within the swarm ylims.
721717 if effect_size_type in ["mean_diff" , "cohens_d" , "hedges_g" ,"cohens_h" ]:
722718 control_group_summary = plot_data .groupby (xvar )\
723- .mean ().loc [current_control , yvar ]
719+ .mean (numeric_only = True ).loc [current_control , yvar ]
724720 test_group_summary = plot_data .groupby (xvar )\
725- .mean ().loc [current_group , yvar ]
721+ .mean (numeric_only = True ).loc [current_group , yvar ]
726722 elif effect_size_type == "median_diff" :
727723 control_group_summary = plot_data .groupby (xvar )\
728724 .median ().loc [current_control , yvar ]
0 commit comments