简体   繁体   中英

GUI for editing and saving a python pandas dataframe

In a python function I want to show the user a pandas dataframe and let the user edit the cells in the dataframe. My function should use the edited values in that dataframe (ie they should be saved).

I've tried pandasgui, but it does not seem to return the edits to the function.

Is there a function/library I can use for this?

Recently solved this problem with dtale

import pandas as pd
import dtale


df = pd.read_csv('table_data.csv')

dt = dtale.show(df)  # create dtale with our df
dt.open_browser()  # bring it to a new tab (optional)

df = dt.data  # connect all the updates from dtale gui and our df 
              # (so rn if u edit any cell, you will immediately get the result saved in ur df)

Yesterday I came across with some bugs while using dtale. Filtering broke my changes and creating some new rows I dont need. Usually I use dtale and pandasgui together. Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM