Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import matplotlib.pyplot as plt
|
|
2 |
from pylab import rcParams
|
3 |
from statsmodels.tsa.seasonal import seasonal_decompose
|
4 |
import streamlit as st
|
5 |
-
import
|
6 |
|
7 |
st.title('Project Canada Goose')
|
8 |
st.write('Mempertahankan brand "canada goose" agar tetap menjadi penjualan tertinggi (untuk 1 tahun kedepan) dengan metode time series forecasting')
|
@@ -13,14 +13,14 @@ def load_csv_data():
|
|
13 |
data = pd.concat(tp, ignore_index=True)
|
14 |
|
15 |
# Convert data yang bukan datetime yang seperti 0000-0000 ke Datetime agar hasilnya NaT
|
16 |
-
data['sold_at'] =
|
17 |
-
data['created_at'] =
|
18 |
-
data['shipped_at'] =
|
19 |
-
data['delivered_at'] =
|
20 |
-
data['returned_at'] =
|
21 |
|
22 |
# Ambil data date dari data setelahnya.
|
23 |
-
data.fillna(method='bfill')
|
24 |
return data
|
25 |
|
26 |
data_load_state = st.text('Loading data...')
|
@@ -158,8 +158,8 @@ arima = auto_arima(y_train,start_p=1, start_q=1, max_p=3, max_q=3, m=12,
|
|
158 |
|
159 |
n_forecast = len(y_test) + 8
|
160 |
pred= arima.predict(n_forecast,D=1,seasonal=(1,0,0))
|
161 |
-
dates =
|
162 |
-
pred=
|
163 |
|
164 |
fig = plt.figure(figsize=(15,5))
|
165 |
plt.title("Prediksi menurut arima untuk 1 tahun kedepan")
|
|
|
2 |
from pylab import rcParams
|
3 |
from statsmodels.tsa.seasonal import seasonal_decompose
|
4 |
import streamlit as st
|
5 |
+
import pandas as pd
|
6 |
|
7 |
st.title('Project Canada Goose')
|
8 |
st.write('Mempertahankan brand "canada goose" agar tetap menjadi penjualan tertinggi (untuk 1 tahun kedepan) dengan metode time series forecasting')
|
|
|
13 |
data = pd.concat(tp, ignore_index=True)
|
14 |
|
15 |
# Convert data yang bukan datetime yang seperti 0000-0000 ke Datetime agar hasilnya NaT
|
16 |
+
data['sold_at'] = pd.to_datetime(data['sold_at'], errors='coerce')
|
17 |
+
data['created_at'] = pd.to_datetime(data['created_at'], errors='coerce')
|
18 |
+
data['shipped_at'] = pd.to_datetime(data['shipped_at'], errors='coerce')
|
19 |
+
data['delivered_at'] = pd.to_datetime(data['delivered_at'], errors='coerce')
|
20 |
+
data['returned_at'] = pd.to_datetime(data['returned_at'], errors='coerce')
|
21 |
|
22 |
# Ambil data date dari data setelahnya.
|
23 |
+
data.fillna(method='bfill', inplace=True)
|
24 |
return data
|
25 |
|
26 |
data_load_state = st.text('Loading data...')
|
|
|
158 |
|
159 |
n_forecast = len(y_test) + 8
|
160 |
pred= arima.predict(n_forecast,D=1,seasonal=(1,0,0))
|
161 |
+
dates = pd.date_range(y_test.index[-1],periods=n_forecast, freq='M')
|
162 |
+
pred= pd.Series(pred, index=dates)
|
163 |
|
164 |
fig = plt.figure(figsize=(15,5))
|
165 |
plt.title("Prediksi menurut arima untuk 1 tahun kedepan")
|