Python中打印adfuller结果时“%”的含义

问题描述 投票:0回答:1

下面的代码中有一个

%
,来自于Python中的ARIMA模型

from statsmodels.tsa.stattools import adfuller
from numpy import log

result = adfuller(df.value.dropna())
print('ADF Statistic: %f' % result[0]) 
print('p-value: %f' % result[1])

我对

%
在 print 语句(最后一行)中的作用感到困惑。它对结果有什么作用? 或者说,它代表的是mod吗?

谢谢!

python dataframe statistics statsmodels arima
1个回答
0
投票

%
符号与字符串插值相关,而不是
print
。这是一种格式化字符串的方法。您可以在这里阅读更多相关信息。

在 python 中格式化字符串有很多方法:

© www.soinside.com 2019 - 2024. All rights reserved.