When dealing with pandas in ipywidgets’ interact, can I set a hierarchy for each item?

Everyone. I am studying various analysis by dealing with statistical data (mainly csv files). Recently, I have been interested in and practicing widgets that can be used in Python.

@interact
def shop_information       (Commercial_sector_classification_1=list(Cd['Shop_section_1'].unique()),
                            Commercial_sector_classification_2=list(Cd['Shop_section_2'].unique()),
                            Commercial_sector_classification_3=list(Cd['Shop_section_3'].unique())):
                           
                            return Cd[(Cd['Shop_section_1'] == Commercial_sector_classification_1)&
                                      (Cd['Shop_section_2'] == Commercial_sector_classification_2)&
                                      (Cd['Shop_section_3'] == Commercial_sector_classification_3)]

This is what I created to filter the information of large, medium, and small classifications.

There is a hierarchy in the commercial sector classification, and it is divided into 1 major category, 2 medium category, and 3 sub category.

By any chance, do you know how to remove from sub-classification other than what was previously filtered by large-classification?



Read more here: https://stackoverflow.com/questions/64944141/when-dealing-with-pandas-in-ipywidgets-interact-can-i-set-a-hierarchy-for-each

Content Attribution

This content was originally published by soohyeong rhee at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: