Skip to content

Conversation

corbanvilla
Copy link
Contributor

@corbanvilla corbanvilla commented Nov 18, 2024

Redo of #60239 but using a feature branch this time :-)

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@rhshadrach rhshadrach added IO LaTeX to_latex Bug Styler conditional formatting using DataFrame.style labels Nov 18, 2024
fix backticks

.. _whatsnew_230.notable_bug_fixes.notable_bug_fix1:

- The ``to_latex`` function is now fixed for hidden multiindex dataframes (:issue:`52218`)
Copy link
Contributor

@attack68 attack68 Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is the right place for this, and its a bit misleading as well. I would write.

...to_latex styling of column headers when combined with a hidden index or hidden index-levels is fixed...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@attack68 Ah didn't see the general bug fixes section... moved and reworded 👍

@corbanvilla corbanvilla requested a review from attack68 November 19, 2024 19:21
@attack68
Copy link
Contributor

Ok I looked a little more at this. The original problem was phrased as not applying to the last column for a styling function that should apply to the whole row. However that isn't really the nature of the problem.

E.g.
Screenshot 2024-11-19 at 20 36 18

Notice that Latex translate seems to get out of line for hidden columns.

Co-authored-by: JHM Darbyshire <[email protected]>
@corbanvilla
Copy link
Contributor Author

Ok I looked a little more at this. The original problem was phrased as not applying to the last column for a styling function that should apply to the whole row. However that isn't really the nature of the problem.
....

Ah interesting... that makes sense.

Copy link
Contributor

@attack68 attack68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Bug fixes
~~~~~~~~~

- The ``to_latex`` styling of column headers when combined with a hidden index or hidden index-levels is fixed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to v3.0.0.rst?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@mroeschke mroeschke added this to the 3.0 milestone Nov 21, 2024
@mroeschke mroeschke merged commit 72bd17c into pandas-dev:main Nov 21, 2024
51 checks passed
@mroeschke
Copy link
Member

Thanks @corbanvilla

KevsterAmp pushed a commit to KevsterAmp/pandas that referenced this pull request Mar 12, 2025
…andas-dev#60356)

* fix to_latex for multiindex

* add newline

* fix styling

* Update v2.3.0.rst

fix backticks

* update description.

* Apply suggested fix

Co-authored-by: JHM Darbyshire <[email protected]>

* move to v.3

* Update pandas/io/formats/style_render.py

Co-authored-by: Matthew Roeschke <[email protected]>

* spacing

* fix whitespace

* fix method name

---------

Co-authored-by: JHM Darbyshire <[email protected]>
Co-authored-by: Matthew Roeschke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug IO LaTeX to_latex Styler conditional formatting using DataFrame.style

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: last column name is not bold when applying bold font to column names together with hiding index before converting to latex

4 participants