-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: latex styler bool pandas options #43670
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
70650f4
latex styler bool options
attack68 5e3ef96
Merge remote-tracking branch 'upstream/master' into styler_latex_options
attack68 6cb583c
remove superfluous options
attack68 a2edbd1
versionadded.
attack68 04823bf
Merge remote-tracking branch 'upstream/master' into styler_latex_options
attack68 29539c3
Merge remote-tracking branch 'upstream/master' into styler_latex_options
attack68 975672d
Merge remote-tracking branch 'upstream/master' into styler_latex_options
attack68 98d0093
Merge remote-tracking branch 'upstream/master' into styler_latex_options
attack68 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,7 +468,7 @@ def to_latex( | |
column_format: str | None = None, | ||
position: str | None = None, | ||
position_float: str | None = None, | ||
hrules: bool = False, | ||
hrules: bool | None = None, | ||
label: str | None = None, | ||
caption: str | tuple | None = None, | ||
sparse_index: bool | None = None, | ||
|
@@ -488,7 +488,7 @@ def to_latex( | |
Parameters | ||
---------- | ||
buf : str, Path, or StringIO-like, optional, default None | ||
Buffer to write to. If ``None``, the output is returned as a string. | ||
Buffer to write to. If `None`, the output is returned as a string. | ||
column_format : str, optional | ||
The LaTeX column specification placed in location: | ||
|
||
|
@@ -509,9 +509,12 @@ def to_latex( | |
\\<position_float> | ||
|
||
Cannot be used if ``environment`` is "longtable". | ||
hrules : bool, default False | ||
hrules : bool | ||
Set to `True` to add \\toprule, \\midrule and \\bottomrule from the | ||
{booktabs} LaTeX package. | ||
Defaults to ``pandas.options.styler.latex.hrules``, which is `False`. | ||
|
||
.. versionchanged:: 1.4.0 | ||
label : str, optional | ||
The LaTeX label included as: \\label{<label>}. | ||
This is used with \\ref{<label>} in the main .tex file. | ||
|
@@ -522,16 +525,17 @@ def to_latex( | |
sparse_index : bool, optional | ||
Whether to sparsify the display of a hierarchical index. Setting to False | ||
will display each explicit level element in a hierarchical key for each row. | ||
Defaults to ``pandas.options.styler.sparse.index`` value. | ||
Defaults to ``pandas.options.styler.sparse.index``, which is `True`. | ||
sparse_columns : bool, optional | ||
Whether to sparsify the display of a hierarchical index. Setting to False | ||
will display each explicit level element in a hierarchical key for each | ||
column. Defaults to ``pandas.options.styler.sparse.columns`` value. | ||
column. Defaults to ``pandas.options.styler.sparse.columns``, which | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one hasn't changed, just clarified docs. |
||
is `True`. | ||
multirow_align : {"c", "t", "b", "naive"}, optional | ||
If sparsifying hierarchical MultiIndexes whether to align text centrally, | ||
at the top or bottom using the multirow package. If not given defaults to | ||
``pandas.options.styler.latex.multirow_align``. If "naive" is given renders | ||
without multirow. | ||
``pandas.options.styler.latex.multirow_align``, which is `"c"`. | ||
If "naive" is given renders without multirow. | ||
|
||
.. versionchanged:: 1.4.0 | ||
multicol_align : {"r", "c", "l", "naive-l", "naive-r"}, optional | ||
|
@@ -550,12 +554,12 @@ def to_latex( | |
If given, the environment that will replace 'table' in ``\\begin{table}``. | ||
If 'longtable' is specified then a more suitable template is | ||
rendered. If not given defaults to | ||
``pandas.options.styler.latex.environment``. | ||
``pandas.options.styler.latex.environment``, which is `None`. | ||
|
||
.. versionadded:: 1.4.0 | ||
encoding : str, optional | ||
Character encoding setting. Defaults | ||
to ``pandas.options.styler.render.encoding`` value of "utf-8". | ||
to ``pandas.options.styler.render.encoding``, which is "utf-8". | ||
convert_css : bool, default False | ||
Convert simple cell-styles from CSS to LaTeX format. Any CSS not found in | ||
conversion table is dropped. A style can be forced by adding option | ||
|
@@ -844,6 +848,7 @@ def to_latex( | |
overwrite=False, | ||
) | ||
|
||
hrules = get_option("styler.latex.hrules") if hrules is None else hrules | ||
if hrules: | ||
obj.set_table_styles( | ||
[ | ||
|
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a versionchanged 1.4 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done