Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

meaning of "%" in printing the result of adfuller in Python

There’s a % 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[0]) 
print('p-value: %f' % result[1])

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?

Thanks!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The % symbol is related to string interpolation rather then the print. It is a way to format string. You can read here more about it.

It is just one of many ways to format strings in python:

  1. “Old Style” String Formatting (% Operator)
  2. “New Style” String Formatting (str.format)
  3. String Interpolation / f-Strings (Python 3.6+)
  4. Template Strings (Standard Library)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading