Last active
October 26, 2018 10:29
-
-
Save shihyu/317316d2e94f210045cd548cba643bd1 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
import pandas as pd | |
import numpy as np | |
import seaborn as sns | |
def magnify(): | |
return [dict(selector="th", | |
props=[("font-size", "4pt")]), | |
dict(selector="td", | |
props=[('padding', "0em 0em")]), | |
dict(selector="th:hover", | |
props=[("font-size", "12pt")]), | |
dict(selector="tr:hover td:hover", | |
props=[('max-width', '200px'), | |
('font-size', '12pt')]) | |
] | |
np.random.seed(25) | |
cmap = cmap=sns.diverging_palette(5, 250, as_cmap=True) | |
bigdf = pd.DataFrame(np.random.randn(20, 25)).cumsum() | |
bigdf.style.background_gradient(cmap, axis=1)\ | |
.set_properties(**{'max-width': '80px', 'font-size': '1pt'})\ | |
.set_caption("Hover to magnify")\ | |
.set_precision(2)\ | |
.set_table_styles(magnify()) | |
bigdf.to_html('/home/yshihyu/a.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment