Skip to content

Export pandas DataFrame #104

Answered by FlorianJacta
vfreysz asked this question in Q&A
Discussion options

You must be logged in to vote

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 …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vfreysz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants