mmmapms commited on
Commit
c58f85c
1 Parent(s): 7bd3595

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
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
- df = pd.read_csv('Predictions.csv')
13
- df['Date'] = pd.to_datetime(df['Date'], dayfirst=True)
14
- df_filtered = df.dropna(subset=['Price'])
 
 
 
 
 
 
 
 
 
 
15
 
16
- df_input = pd.read_csv('DATA_ELIA.csv')
17
- df_input['Date'] = pd.to_datetime(df_input['Date'], dayfirst=True)
 
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()