Annikaijak commited on
Commit
eb893aa
·
verified ·
1 Parent(s): 0b647cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -117,6 +117,24 @@ with tab1:
117
  today = now
118
  yesterday = today - timedelta(days=1)
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  with tab2:
122
 
 
117
  today = now
118
  yesterday = today - timedelta(days=1)
119
 
120
+ df_specific_time_range = building_new[(building_new['time'] >= yesterday) & (building_new['time'] <= now)]
121
+ data_to_normalize = df_specific_time_range[['x', 'y', 'z']]
122
+
123
+ # Applying StandardScaler
124
+ scaler = StandardScaler()
125
+ normalized_data = scaler.fit_transform(data_to_normalize)
126
+
127
+ # Adding normalized data back to the DataFrame
128
+ df_specific_time_range[['x', 'y', 'z']] = normalized_data
129
+
130
+ # Streamlit plotting
131
+ st.title('Normalized values of x, y, z from yesterday to today')
132
+
133
+ # Converting the time column to string for better readability in Streamlit plots
134
+ df_specific_time_range['time'] = df_specific_time_range['time'].astype(str)
135
+
136
+ # Plotting using Streamlit's line chart
137
+ st.line_chart(df_specific_time_range.set_index('time')[['x', 'y', 'z']])
138
 
139
  with tab2:
140