simpledorff icon indicating copy to clipboard operation
simpledorff copied to clipboard

ZeroDivisionError without good explanation

Open juliandehne opened this issue 3 years ago • 2 comments

ZeroDivisionError Traceback (most recent call last)

/tmp/ipykernel_6164/2664903596.py in 21 df_single_title = df_rel[df_rel["grouped_titles"] == title] 22 if len(df_single_title.index) > 1: ---> 23 s_dorf = simpledorff.calculate_krippendorffs_alpha_for_df(df_single_title,experiment_col='grouped_titles', 24 annotator_col='mod_coder_id', 25 class_col='u_mod_rating')

~/PycharmProjects/delab/venv/lib/python3.10/site-packages/simpledorff/simpledorff.py in calculate_krippendorffs_alpha_for_df(df, experiment_col, annotator_col, class_col, metric_fn) 105 class_col=class_col, 106 ) --> 107 return calculate_krippendorffs_alpha(ea_table_df=ea_table_df, metric_fn=metric_fn)

~/PycharmProjects/delab/venv/lib/python3.10/site-packages/simpledorff/simpledorff.py in calculate_krippendorffs_alpha(ea_table_df, metric_fn) 75 ) 76 N = frequency_dict['total'] ---> 77 alpha = 1 - (observed_disagreement / expected_disagreement)*(N-1) 78 return alpha 79

ZeroDivisionError: float division by zero

juliandehne avatar Nov 25 '22 09:11 juliandehne

I'm running into this issue as well! Should be some catch if expected disagreement is 0 to prevent zero division

lyradsouza avatar Jun 22 '23 19:06 lyradsouza