Python Statistics
Python Statistics
# Importing library
# oil is applied
###############################################
import pandas as pd
df = pd.read_excel("C:/Users/user/Documents/sampanova.xlsx")
# generate a boxplot to see the data distribution by treatments. Using boxplot, we can
plt.show()
# stats f_oneway functions takes the groups as input and returns ANOVA F and p value
print(fvalue, pvalue)
# 17.492810457516338 2.639241146210922e-05
import statsmodels.api as sm
print(anova_table)
#######################
# install
# uninstall
################################
t-test
import numpy as np
print(np.var(data_group1), np.var(data_group2))
Method 1
import numpy as np
method 2
# Importing library
import numpy as np
import pingouin as pg
167.123, 165.12])
169.43, 148.123])
result = pg.ttest(data_group1,
data_group2,
correction=True)
# Print the result
print(result)
Method 3
import numpy as np
import pingouin as pg
163.24,
167.123, 165.12])
print(ttest_ind(data_group1, data_group2))