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
ENH: Add option to specify table captions to be below tables in DataFrame.to_latex #46122
Comments
|
@attack68 is the api suggested by @Sleepingwell approved? If so I would add a PR (for the |
Yes True and False are better since this is a binary decision. |
So should the we call the param Otherwise it's kind of murky: |
You certainly mean: https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/io/formats/templates/latex.tpl Is this the old implementation then?: https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/io/formats/latex.py#L610 |
The second link is the old implementation. I have not contriubuted anything to that, so dont know my way around it. Focus on style.py, styler_render.py, and the appropriate jinja2 templates. |
caption_top : True or False is probably best
…On Mon, 5 Dec 2022 at 11:39, DanielHabenicht ***@***.***> wrote:
So should the we call the param caption_position_top then?
Otherwise it's kind of murky: caption_position=True and
caption_position=False
—
Reply to this email directly, view it on GitHub
<#46122 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFZCAKTN4MNLUNJRFEQVBCLWLXA7ZANCNFSM5PC5HPWQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This would be something really useful |
Is your feature request related to a problem?
At present, table captions are always written above the table in the outputs. LaTeX will then render the caption above the table in the resulting document.
I prefer to put captions below tables (and figures) and would like the option to do so added to
DataFrame.to_latex
.Describe the solution you'd like
I propose adding a new argument to
DataFrame.to_latex
, (say caption_position) with a default of'above'
and valid values of'above'
and'below'
. One could equivalently use an Enum, but I'm not sure where that would live and don't think this idiomatic w.r.t. Pandas.An alternative would be an argument caption_above with valid values of
True
andFalse
.I think the docstring would be something like
API breaking implications
With a default, this should not change the API.
Describe alternatives you've considered
At present, I wait until I finally want to submit the document then manually change the files (where I put the output of
DataFrame.to_latex
) manually. Without this feature, I would consider writing a function that takes the output ofDataFrame.to_latex
and rearranges it.Note
I'm happy to have a go at this — if it is not so trivial that someone can do it faster than saying OK — if people are happy with the proposed approach.
The text was updated successfully, but these errors were encountered: