简体   繁体   中英

Normality test of one column using chi-square test in python

I have a df with two columns, one is date and another one is the CO2 Concentration by burning fossil fuels.
I was wondering to see how I can test the normality of a CO2 data over time using chi square test.

I tried code below, but it did not work.

from scipy import stats
stats.chisquare(df_br["CO2"])

remove the null/nan values first before computing the chisquare more information on that function can be found here

from scipy.stats import chisquare
output = chisquare(df['CO2'].dropna())

however as mentioned in the comments you are after the P-VALUE, which would require the following method

chi2, p, dof, expected = chi2_contingency(df['CO2'].dropna())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM