Skip to content
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

REF: Transfer DataFrame.to_latex to Styler implementation for v1.5.0 #45382

Closed
wants to merge 55 commits into from

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Jan 15, 2022

The latest version 1.4.0 issues a generic FutureWarning advising utilising df.style.to_latex, instead of DataFrame.to_latex suggesting arguments signature might change in future.

This PR makes the following changes for 1.5.0:

  • creates a temporary function DataFrame._to_latex_via_styler. This is the v.2.0 goal.
  • fully deprecates and no longer uses col_space which has no impact on LaTeX rendering and is not internally tested. Issues a direct DeprecationWarning.
  • deprecates all other keyword arguments with a FutureWarning but refactors the internal call so that they still pass all tests (whitespace adjusted). (Note that headers as a list of aliases requires ENH: add kwargs rename to Styler.format_index for overwriting index labels #45288 as pre-requisite, which is merged into this PR)
  • implements the new keyword arguments allowing transference to the new signature.

Indirect test impacts that are not just whitespace changes are very minor:

  • test_to_latex_decimal etc. inherits default precision from pd.options.styler.format.precision.
  • test_to_latex_empty_tabular etc. renders a valid empty LaTeX table instead of invalid LaTeX.
  • test_to_latex_longtable_with_index drops curly braces on the "continued on next page" comment.
  • multirow adds an alignment parameter which is available in newer LaTeX renderers.

v1.5.0 Docstring:

Screen Shot 2022-01-15 at 09 01 03
Screen Shot 2022-01-15 at 09 01 19
Screen Shot 2022-01-15 at 09 01 35
Screen Shot 2022-01-15 at 09 01 48

v2.0 Goal Docstring:

Screen Shot 2022-01-15 at 08 31 59

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Feb 21, 2022
@mroeschke
Copy link
Member

Is this PR active? Could this be done in steps?

@attack68
Copy link
Contributor Author

this pr is active, but depends on #45288 which I have tried to get a response to. There is push back to that which I need to either argue against persuasively or accept and close and then devise a new (more complicated way) to replicate the header arg here.

Can this be done in stages?

  • Currently it implements to 2.0 objective style kwargs pass through.
  • Deprecates all other non 2.0 kwargs and replicates their behaviour.

These are probably the only two separate PRs . The deprecations are all or nothing because if at least one deprecated arg is implemented with Styler then all need to be considered to get the final result right.

@attack68
Copy link
Contributor Author

attack68 commented Aug 4, 2022

closed in favour of #47970

@attack68 attack68 closed this Aug 4, 2022
@attack68 attack68 deleted the styler_to_latex_1.5 branch January 19, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants