Skip to content

Instantly share code, notes, and snippets.

@wassname
Created December 23, 2023 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wassname/8c83839abf8de7861d84dc9211623655 to your computer and use it in GitHub Desktop.
Save wassname/8c83839abf8de7861d84dc9211623655 to your computer and use it in GitHub Desktop.
How to style dataframes in vscode
"""
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