This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statsmodels.tsa.arima.model import ARIMA | |
model = ARIMA(df_train, order=(2,1,0)) | |
model_fit = model.fit() | |
print(model_fit.summary()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adf_test = adfuller(df_train_diff) | |
print(f'p-value: {adf_test[1]}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acf_diff = plot_acf(df_train_diff) | |
pacf_diff = plot_pacf(df_train_diff) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_train_diff = df_train.diff().dropna() | |
df_train_diff.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statsmodels.tsa.stattools import adfuller | |
adf_test = adfuller(df_train) | |
print(f'p-value: {adf_test[1]}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf | |
acf_original = plot_acf(df_train) | |
pacf_original = plot_pacf(df_train) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msk = (df.index < len(df)-30) | |
df_train = df[msk].copy() | |
df_test = df[~msk].copy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
df = np.log(df) # don't forget to transform the data back when making real predictions | |
df.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.read_csv('website_data.csv') | |
df.info() | |
df.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import plotly.express as px | |
st.write('# Avocado Prices dashboard') #st.title('Avocado Prices dashboard') | |
st.markdown(''' | |
This is a dashboard showing the *average prices* of different types of :avocado: | |
Data source: [Kaggle](https://www.kaggle.com/datasets/timmate/avocado-prices-2020) | |
''') |