Created
December 23, 2023 22:57
-
-
Save wassname/8c83839abf8de7861d84dc9211623655 to your computer and use it in GitHub Desktop.
How to style dataframes in vscode
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
""" | |
you cannot display, you need to specify html | |
- see also https://pandas.pydata.org/docs/user_guide/style.html#Builtin-Styles | |
""" | |
import pandas as pd | |
from IPython.display import display, HTML | |
df = pd.DataFrame({ | |
"strings": ["Adam", "Mike"], | |
"ints": [1, 3], | |
"floats": [1.123, 1000.23] | |
}) | |
display(HTML( | |
df | |
.style.background_gradient(cmap='Reds') | |
.to_html() | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment