Hasitha16 commited on
Commit
727b706
·
verified ·
1 Parent(s): a44a75e

Update frontend.py

Browse files
Files changed (1) hide show
  1. frontend.py +2 -1
frontend.py CHANGED
@@ -180,7 +180,8 @@ with tab1:
180
  df["date"] = pd.to_datetime(df["timestamp"]).dt.date
181
  trend = df.groupby(["date", "churn_risk"]).size().unstack(fill_value=0).reset_index()
182
  st.markdown("#### 📅 Daily Churn Trend")
183
- fig = px.bar(trend, x="date", y=["High Risk", "Low Risk"], barmode="group")
 
184
  st.plotly_chart(fig, use_container_width=True)
185
  st.download_button("⬇️ Export Trend CSV", trend.to_csv(index=False), "churn_trend.csv")
186
  except Exception as e:
 
180
  df["date"] = pd.to_datetime(df["timestamp"]).dt.date
181
  trend = df.groupby(["date", "churn_risk"]).size().unstack(fill_value=0).reset_index()
182
  st.markdown("#### 📅 Daily Churn Trend")
183
+ y_columns = [col for col in trend.columns if col not in ["date"]]
184
+ fig = px.bar(trend, x="date", y=y_columns, barmode="group")
185
  st.plotly_chart(fig, use_container_width=True)
186
  st.download_button("⬇️ Export Trend CSV", trend.to_csv(index=False), "churn_trend.csv")
187
  except Exception as e: