Export pandas DataFrame #104
-
Hello how can i export a pandas DataFrame has a CSV file using the file_download visual element ? I'm trying somthing like this...
|
Beta Was this translation helpful? Give feedback.
Answered by
FlorianJacta
Mar 11, 2023
Replies: 1 comment
-
Hi! I wrote a little code that will allow you to download your data. The value of the file_download must be a path. I initialize it to a default path that I will use to save my data. import pandas as pd
from taipy.gui import Gui, Markdown
data = pd.DataFrame({"x":[1,2,3],
"y":[4,5,6]})
path_to_csv = "data.csv"
tableau_md = Markdown("""
<|{data}|table|width=fit-content|>
<|{path_to_csv}|file_download|label=Download File|on_action=download_tableau_csv|>
""")
def download_tableau_csv(state):
state.data.to_csv(state.path_to_csv)
pages = {
"Tableau":tableau_md
}
gui_multi_pages = Gui(pages=pages)
gui_multi_pages.run() Don't hesitate to come back if you have more questions! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
vfreysz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I wrote a little code that will allow you to download your data. The value of the file_download must be a path. I initialize it to a default path that I will use to save my data.
Don't hesitate to come back if you have …