Skip to content

WARN: Add FutureWarning for DataFrame.to_latex #44411

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 13 commits into from
Nov 24, 2021
Next Next commit
add warning
  • Loading branch information
attack68 committed Nov 12, 2021
commit 2fa2246bd8fdb83722d66c8c627c81473b0650a2
9 changes: 9 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,15 @@ def to_latex(
\bottomrule
\end{{tabular}}
"""
msg = (
"In future versions `DataFrame.to_latex` is expected to utilise the base "
"implementation of `Styler.to_latex` for formatting and rendering. "
"The arguments signature may therefore change. It is recommended instead to"
"use `DataFrame.style.to_latex` which also contains additional "
"functionality."
)
warnings.warn(msg, FutureWarning, stacklevel=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

use find_stack_level here


# Get defaults from the pandas config
if self.ndim == 1:
self = self.to_frame()
Expand Down