joshuadunlop commited on
Commit
879e393
·
1 Parent(s): ebe5005

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -67,4 +67,19 @@ if st.sidebar.button("Fetch Data"):
67
  df_filtered = df_filtered.drop(columns=['ledgerid', 'transid', 'action'])
68
 
69
  # Display the DataFrame as a table
70
- st.write(df_filtered)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  df_filtered = df_filtered.drop(columns=['ledgerid', 'transid', 'action'])
68
 
69
  # Display the DataFrame as a table
70
+ st.write("Transaction Data")
71
+ st.write(df_filtered)
72
+
73
+ # Create a second table summing the impact for each unique merchantid
74
+ df_sumif = df_filtered.groupby('merchantid')['impact'].sum().reset_index()
75
+
76
+ # Calculate the total impact
77
+ total_impact = df_sumif['impact'].sum()
78
+
79
+ # Add a total row to the DataFrame
80
+ total_row = pd.DataFrame({'merchantid': ['Total'], 'impact': [total_impact]})
81
+ df_sumif = pd.concat([df_sumif, total_row], ignore_index=True)
82
+
83
+ # Display the second DataFrame as a table
84
+ st.write("Impact Summary by Merchant")
85
+ st.write(df_sumif)