-
Notifications
You must be signed in to change notification settings - Fork 370
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
When rendering a pandas data frame with style as a table in pdf, the output produces a second "Table" heading without a title. Although with same table number. The problem does not arise in a html rendering.
Steps to reproduce
---
format:
html:
theme: cosmo
pdf: default
---
# A Table Problem
I think i found a problem with tables from styled (pandas) data frames
from python codes, when rendering them in pdf. The following two code
cells will render as expected to html: two numbered tables with
captions (see @fig-html).
```{python}
#| label: tbl-results
#| tbl-cap: Results.
import pandas as pd
results = {
"Daten": ["x_train", "x_val", "x_test", "x_values"],
"ACC": [1.0, 0.9, 0.8, 0.7],
"ERR": [1, 2, 3, 4],
}
results = pd.DataFrame(results)
results
```
And now with a little style in the data frame representation.
```{python}
#| label: tbl-results-styled
#| tbl-cap: Results with style.
results.style.hide(axis="index").format({"ACC": "{:.3f}", "ERR": "{:.0f}"})
```
But if one renders to pdf, the second styled table has a second
"Table 2" heading without a caption.
::: {#fig-html}

HTML Rendering.
:::
[table-problem-html.pdf](https://github.com/user-attachments/files/21813180/table-problem-html.pdf)
Actual behavior
As mentioned before, the pdf output for the styled pandas data frame has a second "Table" heading.
Expected behavior
I would like the same output as in the html: just the one table heading with caption for a styled pandas data frame.
Your environment
- VSCode 1.103.1
- Windows 10
- Quarto 1.6.39
Quarto check output
PS C:\Users\rrascher-friesenhaus\Documents\quarto\quarto-table> quarto check
Quarto 1.6.39
[>] Checking environment information...
Quarto cache location: C:\Users\rrascher-friesenhaus\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.6.39
Path: C:\Users\rrascher-friesenhaus\AppData\Local\Programs\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[>] Checking LaTeX....................OK
Using: Installation From Path
Path: C:\texlive\2024\bin\windows
Version: 2024
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....OK
Version: 3.12.3 (Conda)
Path: C:/Users/rrascher-friesenhaus/AppData/Local/anaconda3/python.exe
Jupyter: 5.7.2
Kernels: python3
[>] Checking Jupyter engine render....OK
[>] Checking R installation...........OK
Version: 4.5.0
Path: C:/PROGRA1/R/R-451.0
LibPaths:
- C:/Users/rrascher-friesenhaus/AppData/Local/R/win-library/4.5
- C:/Program Files/R/R-4.5.0/library
knitr: 1.50
rmarkdown: 2.29
[>] Checking Knitr engine render......OK