Pragya Jatav commited on
Commit
0611cd8
·
1 Parent(s): f7bb281
pages/2_Scenario_Planner.py CHANGED
@@ -628,6 +628,15 @@ def upload_file_prospects_calc(df):
628
 
629
 
630
  def upload_file_format(df):
 
 
 
 
 
 
 
 
 
631
  df1 = df.transpose()
632
  df1.reset_index(inplace = True)
633
  df1.columns = df1.iloc[0]
@@ -841,6 +850,21 @@ def scenario_planner_plots():
841
 
842
  st.plotly_chart(fig,use_container_width=True)
843
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844
  if auth_status == True:
845
  authenticator.logout("Logout", "main")
846
  st.header("Scenario Planner")
@@ -874,8 +898,11 @@ if auth_status == True:
874
  # )
875
  file_selected = None
876
  if data_selected == "Optimise Uploaded Spends":
 
877
  st.write("Select a file to upload")
 
878
  uploaded_file = st.file_uploader("Choose an Excel file", type=["xlsx", "xls"])
 
879
  if uploaded_file:
880
  try:
881
  # Read the Excel file using pandas
 
628
 
629
 
630
  def upload_file_format(df):
631
+ key_df = pd.DataFrame()
632
+ key_df["channel"] = ["Broadcast TV","Cable TV","Connected & OTT TV","Display Prospecting","Display Retargeting","Video","Social Prospecting","Social Retargeting","Search Brand","Search Non-brand","Digital Partners","Audio","Email"]
633
+
634
+ key_df["channels"] = ["BroadcastTV","CableTV","Connected&OTTTV","DisplayProspecting","DisplayRetargeting","\xa0Video","SocialProspecting","SocialRetargeting","SearchBrand","SearchNon-brand","DigitalPartners","Audio","Email"]
635
+ df = df.merge(key_df,on = "channel", how = "inner")
636
+ # st.dataframe(df)
637
+ df["channel"] = df["channels"]
638
+ df.drop(columns = ["channel"])
639
+
640
  df1 = df.transpose()
641
  df1.reset_index(inplace = True)
642
  df1.columns = df1.iloc[0]
 
850
 
851
  st.plotly_chart(fig,use_container_width=True)
852
 
853
+ def give_demo():
854
+ def get_file_bytes(file_path):
855
+ with open(file_path, 'rb') as file:
856
+ return file.read()
857
+
858
+ # Path to the existing Excel file
859
+ file_path = 'test upload.xlsx'
860
+
861
+ # Create a download button
862
+ st.download_button(
863
+ label="Download Input File Format",
864
+ data=get_file_bytes(file_path),
865
+ file_name=file_path,
866
+ mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
867
+ )
868
  if auth_status == True:
869
  authenticator.logout("Logout", "main")
870
  st.header("Scenario Planner")
 
898
  # )
899
  file_selected = None
900
  if data_selected == "Optimise Uploaded Spends":
901
+ give_demo()
902
  st.write("Select a file to upload")
903
+
904
  uploaded_file = st.file_uploader("Choose an Excel file", type=["xlsx", "xls"])
905
+ # give_demo()
906
  if uploaded_file:
907
  try:
908
  # Read the Excel file using pandas
summary_df.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6828b9886464f55ba02eb0b7cd0f315e46f06c8ba520c041294ec6ff7d426965
3
  size 1822
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cd7ff28a293b4940e87fc8154de04897eb9a42b8eb4bd6cf3a0e64e280f2d99
3
  size 1822
test upload.xlsx ADDED
Binary file (9.76 kB). View file