Created
January 3, 2022 07:23
-
-
Save kshirsagarsiddharth/cd5c4c5d5e17fce528259da2ac17ec62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def interactive_crosstab(index = 'loan_grade', column = 'loan_intent'): | |
crosstab = pd.crosstab(df[index], df[column]).style.text_gradient(cmap = 'icefire').applymap(lambda x : 'font-size:22.2px; font-weight:bold') | |
return (crosstab.set_table_styles([ | |
{ | |
"selector":"thead", | |
"props": [("background-color", "#d0d0df"), | |
("color", "black"), | |
("font-size", "20px"), ("font-style", "bold")] | |
}, | |
{ | |
"selector":"th.row_heading", | |
"props": [("background-color", "#7ebecc"), | |
("color", "black"), | |
("font-size", "2rem"), | |
("font-style", "bold") | |
] | |
}, | |
])) | |
F = interact(interactive_crosstab, | |
index = widgets.Dropdown( | |
options = ['person_home_ownership', 'loan_intent', 'loan_grade','cb_person_default_on_file','loan_status'] | |
), | |
column = widgets.Dropdown( | |
options = ['person_home_ownership', 'loan_intent', 'loan_grade','cb_person_default_on_file','loan_status'], | |
index = 1 | |
) | |
) | |
interactive(children=(Dropdown(description='index', options=('person_home_ownership', 'loan_intent', 'loan_gra… |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment