import pandas as pd
from scipy.stats import chisquare
import scipy.stats as stats
# df라는 데이터프레임에 x7_2, x5라는 변수가 존재한다고 했을 때!
result_31=pd.crosstab(df.x7_2, df.x5)
result_31_chi, p, dof, ex = stats.chi2_contingency(observed=result_31)
# p : p-value
chi-square test
'언어 꿀Tip > Python 꿀tip!' 카테고리의 다른 글
07_01_45. groupby 컬럼명 level 합치기 (0) | 2021.06.04 |
---|---|
07_01_44. seaborn multiple line chart 여러개 동시에 그래프그리기 (0) | 2021.06.03 |
07_01_41. 그래프 범례 삽입 (graph legend), 여러 line 겹쳐 그리기 (0) | 2021.05.28 |
07_01_40. matplotlib plot 크기 조정 (plot size) (0) | 2021.05.27 |
07_01_39. matplotlib 그래프 이중축 graph 생성 및 축이름 (0) | 2021.05.27 |