% in the following code, which is from ARIMA Model in Python .
from statsmodels.tsa.stattools import adfuller from numpy import log result = adfuller(df.value.dropna()) print('ADF Statistic: %f' % result) print('p-value: %f' % result)
I’m confused to what the
% does in the print statement (last line). What does it do to the result?
Or, does it represent mod?
% symbol is related to string interpolation rather then the
It is just one of many ways to format strings in python:
- “Old Style” String Formatting (% Operator)
- “New Style” String Formatting (str.format)
- String Interpolation / f-Strings (Python 3.6+)
- Template Strings (Standard Library)