import pandas as pd
from scipy.stats import chi
tabela_t_chi_2 = pd.DataFrame(
[],
index=[i for i in range(1, 31)],
columns = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95, 0.975, 0.99, 0.995]
)
for index in tabela_t_chi_2.index:
for column in tabela_t_chi_2.columns:
tabela_t_chi_2.loc[index, column] = '{0:0.4f}' .format(chi.ppf(float(column), index) ** 2)
tabela_t_chi_2.index.name = 'Grau de Liberdade (n - 1)'
tabela_t_chi_2.rename_axis(['p'], axis = 1, inplace = True)
tabela_t_chi_2