---
title: "Data In: Baldessari OCR"
format:
  html:
    toc: false
    code-fold: true
    code-summary: "Show code"
execute:
  echo: true
---

From: [https://nfdi4culture.github.io/linked-open-exhibition/catalogue-baldessari.html](https://nfdi4culture.github.io/linked-open-exhibition/catalogue-baldessari.html)

This table is generated directly from the CSV file in the project.

```{python}
import csv
from html import escape
from IPython.display import HTML, display

csv_path = "data/output-plan-b-readable.csv"
with open(csv_path, newline="", encoding="utf-8") as f:
    rows = list(csv.DictReader(f))

if rows:
    headers = list(rows[0].keys())
    body = []
    for row in rows:
        body.append(
            "<tr>" + "".join(
                f"<td>{escape(str(row.get(h, '')))}</td>" for h in headers
            ) + "</tr>"
        )

    table_html = (
        "<table class=\"table table-sm table-striped table-hover\" border=\"0\">"
        "<thead><tr>"
        + "".join(f"<th>{escape(h)}</th>" for h in headers)
        + "</tr></thead><tbody>"
        + "".join(body)
        + "</tbody></table>"
    )
    display(HTML(table_html))
else:
    print("No data rows were found in the CSV.")
```
