-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow left/center as table cell alignment format for notebooks #15822
Comments
Related codes
|
I think this is a good idea; in other areas1 of the 貢献を歓迎します :) Footnotes |
@alexander-beedie Just a draft, but I created PR #15830 to use "POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT" in I'm trying the following unchecked tasks. To-do
|
…tebooks pola-rs#15822 * feat: set text_align with POLARS_FMT_TABLE_CELL_ALIGNMENT env variable * docs: mention expected impact of set_tbl_cell_alignment in docstring * fix: KeyError when un-assigned * docs: fix W505 Doc line too long (111 > 88) * docs: fix D205 1 blank line required between summary line and description * fix: text_align tag is not lower case * feat: set numeric text align with POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT env variable * docs: mention expected impact of set_tbl_cell_numeric_alignment in docstring * docs: fix D417 Missing argument description in the docstring for `get_attributes`: `col_idx` * docs: update docstring for clarification * refactor: access environment variables at DataFrame level * docs: fix D213 [*] Multi-line docstring summary should start at the second line * docs: fix W505 Doc line too long (99 > 88) * fix: F821 Undefined name `numeric_align` * test: add tests with _repr_html and table cell alignment settings * fix: AttributeError * fix: lines too long * test: fix F541 [*] f-string without any placeholders * fix: lines too long * refactor: fix errors suggested by lint * refactor: reorder variable assignment * refactor: fix errors suggested by lint * refactor: fix error suggested by lint * test: remove unnecessary characters * test: fix errors suggested by lint * test: fix errors suggested by lint * test: fix errors suggested by lint * test: fix typo * fix: ignore[arg-type] for mypy * fix: Return value expected [return-value] * refactor: get attributes at once * fix: KeyError: '\n text-align' * fix: Value of type "set[dict[str, str] | None]" is not indexable * fix: KeyError by f-string with unescaped {} * refactor: fix format * fix: Value of type "Set[Dict[str, str]]" is not indexable * refactor * fix: used set mistakenly * fix: Key expression in dictionary comprehension has incompatible type "int"; expected type "str" [misc] * refactor * fix: Argument 3 to "Tag" has incompatible type "**Dict[str, str]"; expected "Optional[Dict[str, str]]" [arg-type] * fix: TypeError: Tag.__init__() got an unexpected keyword argument 'align' * fix: Value expression in dictionary comprehension has incompatible type "Optional[Dict[str, str]]"; expected type "Dict[str, str]" [misc] * fix: Value of type "dict[int, dict[str, str]] | None" is not indexable [index] * fix: repeated code outside conditional statement * refactor: accept code_reginement Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * refactor: accept code_reginement Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Revert "refactor: accept code_reginement" This reverts commit 3b4a9b5. * Revert "refactor: accept code_reginement" This reverts commit 4e0d734. --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@alexander-beedie I struggled to use pre-commit on my PC today, but could not install ruff check with errors.
libunwind: stepWithCompactEncoding - invalid compact unwind encoding
error: test failed, to rerun pass `-p polars-sql --test statements` |
Description
Description
We use
polars.Config.set_tbl_cell_alignment()
to change the table cell alignment format forprint(pl.DataFrame())
.However, this configuration does not work when calling
display(pl.DataFrame())
on Jupyter Notebook and Google Colab.It will be useful for notebook users to allow left/center as formats of
display(pl.DataFrame())
.With polars version 0.20.22 on Google Colab:
https://gist.github.com/lisphilar/6036542413e2b5991751d706541a7795
Solution
If I understand the codes correctly, we can add this feature by updating the following lines, especially 165 line (
"text-align: right;"
).polars/py-polars/polars/dataframe/_html.py
Lines 153 to 177 in 3d100a8
(I'd like to try my first PR, if acceptable.)
The text was updated successfully, but these errors were encountered: