如何用F弦绕过分数系数
携带chi2
在某些应变表上进行测试(use:scipy.stats.chi2_contingency(mytable)
),我得到了一些统计信息:
stat=215.87297677691768
p=1.6223014100068392e-27
dof=36
然后,我使用>
打印这些结果f-string
格式:
new_line = '\n'
print(
f'Chi2 value = {stat:.4f}{new_line}'
f'p-value = {p}{new_line}'
f'Degrees of freedom = {dof}{new_line}'
)
这给了我输出:
Chi2 value = 215.8730
p-value = 1.6223014100068392e-27
Degrees of freedom = 36
是否可以在p-value
f-string
中修改某些内容,以便具有分数系数用4位数字打印的p-value
,因此获取输出:
Chi2 value = 215.8730
p-value = 1.6223e-27
Degrees of freedom = 36
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论