AnswerDotAI / AnswerDotAI/nbdev
Dataframe HTML tags showing up in exported README
- Dominant language
- Jupyter Notebook
- Stars
- 5.3k
- Forks
- 513
- Avg merge
- 2d 30m
- Merged PRs (30d)
- 8
Description
Related to https://github.com/fastai/nbdev/issues/474
Rendered readme on Github: https://github.com/rxavier/poniard/blob/experiment/nbdev/README.md
index.ipynb: https://github.com/rxavier/poniard/blob/experiment/nbdev/nbs/index.ipynb
Basically, "raw output" dataframes (for example, when a method simply returns a dataframe, like `get_results` in this example) get this added before the actual table in markdown:
```
.dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
```
Meanwhile, dataframes rendered with `display(HTML(df.to_html()))` (which shows after `setup` in this example) display fine.
Quarto HTML docs render any of these fine.
Edit: I implemented an ugly temporary fix by using directives and ipython's `display`:
```python
#| output: false
obj.method_that_outputs_a_df()
```
```python
#| echo: false
from ipython import display, HTML
df = obj.method_that_outputs_a_df()
display(HTML(df.to_html()))
```
Contributor guide
Assessment
This issue has not been assessed yet.