AnswerDotAI / AnswerDotAI/nbdev

Dataframe HTML tags showing up in exported README

Đang mở
#1,155 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Jupyter Notebook
Star
5.3k
Fork
513
Merge trung bình
2 ngày 30 phút
Pull request đã merge (30 ngày)
8

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter-notebook, python
Lĩnh vực
documentation
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.