Chi-square test category형 변수별 target 과의 유의차가 있는지 검정할 때, Category변수가 많다면 아래와 같이 for문으로 작성하는 것이 더 편합니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 from scipy.stats import chi2_contingency chi_list=['cat1', 'cat2', 'cat3'] chi_val_list=[] chi_p_list=[] for i in chi_list: # contingency: 관측도수 contingency= pd.crosstab(df[i], df['target']) # dof: degree of freedom # expected: chi, p, dof, expected =chi2_conti..