Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,19 +62,22 @@ with tabs[0]:
|
|
| 62 |
|
| 63 |
st.altair_chart(chart, use_container_width=True)
|
| 64 |
|
| 65 |
-
# Volume by ETA
|
| 66 |
st.subheader("Shipment Volume by ETA")
|
| 67 |
-
|
|
|
|
| 68 |
'MAWB': 'count',
|
| 69 |
'Cartons': 'sum',
|
|
|
|
|
|
|
| 70 |
}).reset_index().rename(columns={'MAWB': 'Shipment Count'})
|
| 71 |
|
| 72 |
st.dataframe(volume_by_eta, use_container_width=True)
|
| 73 |
|
| 74 |
line_chart = alt.Chart(volume_by_eta).mark_line(point=True).encode(
|
| 75 |
-
x='
|
| 76 |
y='Cartons:Q',
|
| 77 |
-
tooltip=['
|
| 78 |
).properties(height=400)
|
| 79 |
|
| 80 |
st.altair_chart(line_chart, use_container_width=True)
|
|
@@ -103,5 +106,5 @@ with tabs[1]:
|
|
| 103 |
last_mile_col = [col for col in df_ctn.columns if "last mile" in col.lower()][0]
|
| 104 |
|
| 105 |
# Group by Last Mile Service and aggregate by row count
|
| 106 |
-
grouped = df_ctn.groupby(last_mile_col).size().reset_index(name='
|
| 107 |
st.dataframe(grouped, use_container_width=True)
|
|
|
|
| 62 |
|
| 63 |
st.altair_chart(chart, use_container_width=True)
|
| 64 |
|
| 65 |
+
# Volume by ETA (grouped by date only)
|
| 66 |
st.subheader("Shipment Volume by ETA")
|
| 67 |
+
df['ETA_Date'] = df['ETA'].dt.date
|
| 68 |
+
volume_by_eta = df.groupby('ETA_Date').agg({
|
| 69 |
'MAWB': 'count',
|
| 70 |
'Cartons': 'sum',
|
| 71 |
+
'Packages': 'sum',
|
| 72 |
+
'Weights': 'sum'
|
| 73 |
}).reset_index().rename(columns={'MAWB': 'Shipment Count'})
|
| 74 |
|
| 75 |
st.dataframe(volume_by_eta, use_container_width=True)
|
| 76 |
|
| 77 |
line_chart = alt.Chart(volume_by_eta).mark_line(point=True).encode(
|
| 78 |
+
x='ETA_Date:T',
|
| 79 |
y='Cartons:Q',
|
| 80 |
+
tooltip=['ETA_Date:T', 'Shipment Count:Q', 'Cartons:Q', 'Packages:Q', 'Weights:Q']
|
| 81 |
).properties(height=400)
|
| 82 |
|
| 83 |
st.altair_chart(line_chart, use_container_width=True)
|
|
|
|
| 106 |
last_mile_col = [col for col in df_ctn.columns if "last mile" in col.lower()][0]
|
| 107 |
|
| 108 |
# Group by Last Mile Service and aggregate by row count
|
| 109 |
+
grouped = df_ctn.groupby(last_mile_col).size().reset_index(name='Row Count')
|
| 110 |
st.dataframe(grouped, use_container_width=True)
|