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",
|
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_csv(OUT_DIR / "data.csv", index=False)
|
||||||
df.to_excel(OUT_DIR / "data.xlsx", index=False)
|
df.to_excel(OUT_DIR / "data.xlsx", index=False)
|
||||||
df.to_json(
|
df.to_json(
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="data.csv">Lähdedata (CSV)</a></li>
|
<li><a href="data.csv">Lähdedata (CSV)</a></li>
|
||||||
<li><a href="data.html">Lähdedata (HTML)</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.json">Lähdedata (JSON)</a></li>
|
||||||
<li><a href="data.xlsx">Lähdedata (XLSX)</a></li>
|
<li><a href="data.xlsx">Lähdedata (XLSX)</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ body.table-body {
|
|||||||
|
|
||||||
body.table-body table {
|
body.table-body table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.table-body td,
|
body.table-body td,
|
||||||
@@ -35,6 +36,10 @@ body.table-body th {
|
|||||||
border: 1px solid #999;
|
border: 1px solid #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.table-body tr th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
h3 {
|
h3 {
|
||||||
|
|||||||
Reference in New Issue
Block a user