Created
May 30, 2022 18:31
-
-
Save CharlyWargnier/fc8989ceaf4ac627efbd49be6693b6e9 to your computer and use it in GitHub Desktop.
Streamlit - download_csv via markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_csv("reuters-allcats.csv") | |
csv = df.to_csv(index=False) | |
b64 = base64.b64encode(csv.encode()).decode() | |
href = f'<a href="data:file/csv;base64,{b64}" download="myfilename.csv">Try a sample first</a>' | |
st.markdown("👆 Upload a .csv file. " + href, unsafe_allow_html=True) | |
st.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment