jeudi 18 avril 2019

Using checkbox as User Input to filter data in Pandas

I have a data frame I would like the user to be able to filter based on the values in a specific column

I was able to create an initial option using user input.

def get_subset(df):
    table = input('\nWhich table? Account or Transactions?\n')
    return df[df['Table'] == table]

But this won't be feasible once I have more values in the Table column. I was hoping to create checkboxes and that would be used to filter the data. Like below:

import ipywidgets as widgets

widgets.Checkbox(
    value=False,
    description= ('account'),
    disabled=False
)

But this gave me one checkbox. I am not able to create this for all values in the table column or to connect it to filter data. Does Pandas have this capability?




Aucun commentaire:

Enregistrer un commentaire