Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Created September 26, 2019 21:31
Show Gist options
  • Select an option

  • Save marcosan93/1aaedd7d907c41c7615a77fc4d66f575 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/1aaedd7d907c41c7615a77fc4d66f575 to your computer and use it in GitHub Desktop.
# Converting the data to a logarithmic scale
bc_log = pd.DataFrame(np.log(bc.Close))
# Differencing the log values
log_diff = bc_log.diff().dropna()
# Using the Dickey-Fuller test to check for stationarity
results = adfuller(log_diff.Close)
print(f"P-value: {results[1]}")
@xavave
Copy link

xavave commented Mar 23, 2021

what's the adfuller? I try to use it but kept giving me error and I couldn't find out why

from statsmodels.tsa.stattools import adfuller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment