Skip to content

Instantly share code, notes, and snippets.

@joseberlines
Created March 17, 2022 12:30
Show Gist options
  • Save joseberlines/694259ce8299e179cdc1877e6baaccbd to your computer and use it in GitHub Desktop.
Save joseberlines/694259ce8299e179cdc1877e6baaccbd to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
from ipydatagrid import DataGrid,TextRenderer
import ipydatagrid as grid
print(grid.__version__)
df = pd.DataFrame(
data={
"Col1HasAVeryLongName": ['qwerwqerqweddg d dgggfgfg dg dg drwqerwqer','qwer wer qwerdg wqer','asdf asdfasdasdfsadf'],
"Col2MediumName": [4, 5, 6],
"Col3": [7, 8, 9],
}
)
header_renderer = TextRenderer(
text_color="navy",
text_wrap=True,
vertical_alignment="top",
background_color="moccasin",
horizontal_alignment="center",
)
g = DataGrid(df,
index_name="index_column",
header_renderer=header_renderer)
g.auto_fit_columns = True
display(g)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment