After carrying a Chi2
test on some contingency table (using: scipy.stats.chi2_contingency(myTable)
) I get some statistics:
stat=215.87297677691768
p=1.6223014100068392e-27
dof=36
I then print these results using the f-string
formatting:
new_line = '\n'
print(
f'Chi2 value = {stat:.4f}{new_line}'
f'p-value = {p}{new_line}'
f'Degrees of freedom = {dof}{new_line}'
)
This gives me the output:
Chi2 value = 215.8730
p-value = 1.6223014100068392e-27
Degrees of freedom = 36
Is it possible to modify something in the p-value
f-string
in order to have the fractional coefficient of the p-value
printed with 4 digits and so get the output:
Chi2 value = 215.8730
p-value = 1.6223e-27
Degrees of freedom = 36