Skip to content

Conversation

@parthava-adabala
Copy link

  • closes ENH: \centering option for DataFrame.to_latex() method #62733
  • [Tests added and passed] if fixing a bug or adding a new feature
  • All [code checks passed]
  • Added [type annotations] to new arguments/methods/functions
  • Added an entry in the latest doc/source/whatsnew/v3.0.0.rst file if fixing a bug or adding a new feature
@parthava-adabala
Copy link
Author

The "Test pandas for Pyodide" job keeps failing with a network error (Failed to restore: Cache service responded with 400). It seems like a CI infrastructure issue.

Could a maintainer please take a look or re-run the job? Thanks!

@attack68
Copy link
Contributor

This PR is unwieldy and unnecessary. It is already possible to add centering to a Latex Table using the more general and more descriptive keyword argument position_float. You simply do:

df = DataFrame([[1,2],[3,4]]) print(df.style.to_latex(position_float="centering")) ### \begin{table} \centering \begin{tabular}{lrr} & 0 & 1 \\ 0 & 1 & 2 \\ 1 & 3 & 4 \\ \end{tabular} \end{table} ###

Furthermore the documentation describes using the Styler to provide more features for a DataFrame.to_latex conversion. We are not currently adding features to DataFrame.to_latex because it creates unnecessary work for maintainers.

@attack68 attack68 closed this Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants