HFUsman commited on
Commit
ebb65bf
·
verified ·
1 Parent(s): 7a8c3ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -90,6 +90,25 @@ if uploaded_file is not None:
90
  plt.title('Traffic Flow Distribution by Hour')
91
  st.pyplot()
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  # Optional Feature scaling (if user wants to apply scaling)
94
  st.write("### Feature Scaling")
95
  if st.checkbox('Apply Standard Scaling'):
 
90
  plt.title('Traffic Flow Distribution by Hour')
91
  st.pyplot()
92
 
93
+ # Traffic Data Summary
94
+ st.write("### Traffic Data Summary")
95
+
96
+ # Calculate the total traffic count and average traffic flow
97
+ total_traffic_count = total_traffic_by_hour.sum()
98
+ avg_traffic_flow = total_traffic_by_hour.mean()
99
+
100
+ # Find the peak traffic hour and the lowest traffic hour
101
+ peak_traffic_hour = total_traffic_by_hour.idxmax()
102
+ peak_traffic_value = total_traffic_by_hour.max()
103
+ lowest_traffic_hour = total_traffic_by_hour.idxmin()
104
+ lowest_traffic_value = total_traffic_by_hour.min()
105
+
106
+ # Display the summary
107
+ st.write(f"**Total Traffic Count**: {total_traffic_count:,}")
108
+ st.write(f"**Average Traffic Flow per Hour**: {avg_traffic_flow:.2f}")
109
+ st.write(f"**Peak Traffic Hour**: {peak_traffic_hour}:00 with {peak_traffic_value:,} vehicles.")
110
+ st.write(f"**Lowest Traffic Hour**: {lowest_traffic_hour}:00 with {lowest_traffic_value:,} vehicles.")
111
+
112
  # Optional Feature scaling (if user wants to apply scaling)
113
  st.write("### Feature Scaling")
114
  if st.checkbox('Apply Standard Scaling'):