Created
March 17, 2022 12:30
-
-
Save joseberlines/694259ce8299e179cdc1877e6baaccbd 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 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