fatmacankara commited on
Commit
a0f4539
·
1 Parent(s): efb78a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -107,12 +107,18 @@ def download_df():
107
  download_button(selected_df, st.session_state.filename),
108
  height=0,
109
  )
110
-
111
-
112
  selected_df = selected_df.astype(str)
113
  st.write(selected_df)
114
  with st.form("download_form", clear_on_submit=False):
115
  st.text_input("Enter filename", key="filename")
116
  submit = st.form_submit_button("Download", on_click=selected_df)
117
 
118
-
 
 
 
 
 
 
 
 
107
  download_button(selected_df, st.session_state.filename),
108
  height=0,
109
  )
110
+ """
 
111
  selected_df = selected_df.astype(str)
112
  st.write(selected_df)
113
  with st.form("download_form", clear_on_submit=False):
114
  st.text_input("Enter filename", key="filename")
115
  submit = st.form_submit_button("Download", on_click=selected_df)
116
 
117
+ """
118
+ def convert_df(df):
119
+ return df.to_csv(index=False).encode('utf-8')
120
+
121
+
122
+ csv = convert_df(selected_df)
123
+
124
+ st.download_button("Press to Download", csv,"file.csv","text/csv",key='download-csv')