AnswerDotAI / AnswerDotAI/nbdev

Dataframe HTML tags showing up in exported README

Abierto
#1,155 5 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Jupyter Notebook
Estrellas
5.3k
Forks
513
Merge medio
2 d 30 min
PR fusionados (30 d)
8

Descripción

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()))
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with nbs/index.ipynb and the exported README linked in the issue, then reproduce a raw dataframe return such as get_results and compare it with display(HTML(df.to_html())). The fix is complete when exported README markdown renders the dataframe without the unwanted style tags, while the table remains visible.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
jupyter-notebook, python
Área
documentation
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.