Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,23 @@ def convert_df_to_csv(df):
|
|
9 |
return df.to_csv(index=False).encode('utf-8')
|
10 |
|
11 |
# Load your data
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
df_input
|
|
|
18 |
|
19 |
# Determine the first and last date
|
20 |
min_date_allowed = df_input['Date'].min().date()
|
|
|
9 |
return df.to_csv(index=False).encode('utf-8')
|
10 |
|
11 |
# Load your data
|
12 |
+
@st.cache_data
|
13 |
+
def load_data_elia():
|
14 |
+
df = pd.read_csv('DATA_ELIA.csv')
|
15 |
+
df['Date'] = pd.to_datetime(df['Date'], dayfirst=True)
|
16 |
+
return df
|
17 |
+
|
18 |
+
# Caching data loading for Predictions.csv
|
19 |
+
@st.cache_data
|
20 |
+
def load_data_predictions():
|
21 |
+
df = pd.read_csv('Predictions.csv')
|
22 |
+
df['Date'] = pd.to_datetime(df['Date'], dayfirst=True)
|
23 |
+
df_filtered = df.dropna(subset=['Price'])
|
24 |
+
return df, df_filtered
|
25 |
|
26 |
+
# Load your data
|
27 |
+
df_input = load_data_elia()
|
28 |
+
df, df_filtered = load_data_predictions()
|
29 |
|
30 |
# Determine the first and last date
|
31 |
min_date_allowed = df_input['Date'].min().date()
|