How to create a loop in Python (ADF test with p-value check)
问题 I need a little help with creating a loop in Python. Here's the code that I'm using: import pandas as pd import numpy as np import math import matplotlib.pyplot as plt from statsmodels.graphics.tsaplots import plot_acf from statsmodels.graphics.tsaplots import plot_pacf %matplotlib inline df= pd.read_csv('original_data.csv', index_col='1') from statsmodels.tsa.stattools import adfuller def adf_test(timeseries): #Perform Dickey-Fuller test: test_types = ['nc','c','ct'] for tests in test_types: