mirror of
https://github.com/koodiklinikka/palkkakysely.git
synced 2026-01-26 03:14:03 +00:00
Add vertical HTML
This commit is contained in:
@@ -26,6 +26,18 @@ def write_massaged_files(env, df):
|
||||
body_class="table-body",
|
||||
),
|
||||
)
|
||||
with open(OUT_DIR / "data-vertical.html", "w") as f:
|
||||
with io.StringIO() as s:
|
||||
for _, row in df.iterrows():
|
||||
row.dropna().to_frame().to_html(s, header=False, na_rep="", border=0)
|
||||
s.write("\n")
|
||||
table_html = s.getvalue()
|
||||
f.write(
|
||||
env.get_template("_table.html").render(
|
||||
table_html=table_html,
|
||||
body_class="table-body",
|
||||
),
|
||||
)
|
||||
df.to_csv(OUT_DIR / "data.csv", index=False)
|
||||
df.to_excel(OUT_DIR / "data.xlsx", index=False)
|
||||
df.to_json(
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<ul>
|
||||
<li><a href="data.csv">Lähdedata (CSV)</a></li>
|
||||
<li><a href="data.html">Lähdedata (HTML)</a></li>
|
||||
<li><a href="data-vertical.html">Vastaukset eriteltyinä (HTML)</a></li>
|
||||
<li><a href="data.json">Lähdedata (JSON)</a></li>
|
||||
<li><a href="data.xlsx">Lähdedata (XLSX)</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -27,6 +27,7 @@ body.table-body {
|
||||
|
||||
body.table-body table {
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
body.table-body td,
|
||||
@@ -35,6 +36,10 @@ body.table-body th {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
body.table-body tr th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
|
||||
Reference in New Issue
Block a user