How to use Quarto embed to include notebook output which is a pandas DataFrame but with correct column title alignment? #6506
-
DescriptionExploring the notebook embed option and notice the pandas DataFrame does not render properly, specifically the header or column names, which are shifted to the right. There is a way to show the headers or column names properly when using embed? Here reproducible example: https://github.com/lgonzalezsa/hello_quarto/blob/main/test/presentation.md Using Quarto 1.3.450 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
You need to disable Quarto processing (https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing) or to output raw HTML code. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your response! I was able to test the IPython display Markdown option and the pandas.to_markdown() html = markdown_string.to_html().replace(
"<table>", '<table data-quarto-disable-processing="true">'
)
Markdown(html) Here the result of my testing: |
Beta Was this translation helpful? Give feedback.
-
Here new repo: https://github.com/lgonzalezsa/quarto_embed |
Beta Was this translation helpful? Give feedback.
-
Thank you very much! I changed the code to use My bad for not adding the requirements.txt, I updated the repo accordingly. 2023-08-24.15-35-38.mp4 |
Beta Was this translation helpful? Give feedback.
You need to disable Quarto processing (https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing) or to output raw HTML code.
See Pandas and IPython documentation to tweak outputs.