This is a simple custom styler for tables, inspired by this Medium post and this UX talk, based on the following rules:
- text (and dates) items should be aligned left;
- headings should be easily recognized from the items.
The following example
(
TableStyler(
pandas.DataFrame(
data={
"Text column": 3
* [
"This is not long enough, it needs to be really much longer to show a line break. This hopefully should do the trick as expected."
]
+ 3 * ["This is short"],
"Number column": 3 * [91] + 3 * [1243],
"Another Number column": 3 * [91] + 3 * [1243],
"Date column quite long": pandas.date_range(
start="1970-01-01", periods=6, freq="d"
),
}
)
.hide_index()
.format_columns(numerical_format="{:,}", date_format="{:%b %d, %Y}")
.render()
)
)
will render in a browser as