-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtables.py
More file actions
43 lines (34 loc) · 1.81 KB
/
tables.py
File metadata and controls
43 lines (34 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pandas as pd
from tabulate import tabulate
import matplotlib.pyplot as plt
from pathlib import Path
import seaborn as sns
sns.set_context('talk')
sns.set_palette("muted", n_colors = 11)
responseloc = Path("/mnt/ahoerman/outreach/sxns17/survey")
outloc = Path("/mnt/ahoerman/outreach/2024_SAS/talk/survey")
responses = pd.read_excel(responseloc / "GISAS instrument survey(1-16).xlsx",
sheet_name="Form1")
columns = {"sampleholder": "What do you use as a sample holder?\n",
"alignment_specialty": "Is there an aspect of sample alignment you payed particular attention to? Something you might do differently than anybody else?",
"calibration_specialty": "Is there an aspect of calibration you payed particular attention to? Something you might do differently than anybody else?",
"instrument_specialty": "What characteristic sets your instrument apart from all or most others?\n",
"alignment_routine": """Please share your alignment routine (or representative section thereof) via
- link to a public repo or
- by contributing to this gist:
https://gist.github.com/ahoermann/d44605100109964ccdbd2f...""",
"calibration_routine": """Please share your calibration routine (or representative section thereof) via
- link to a public repo or
- by contributing to this gist:
https://gist.github.com/ahoermann/d44605100109964ccdbd..."""
}
instrumentcol = "What is the name of your instrument?\n"
def add_line_breaks(text):
return text.replace('\n', '<br>')
for id, col in columns.items():
#fig, ax = plt.subplots()
data = responses[[instrumentcol, col]]
df_styled = data.style.format({'Text': add_line_breaks})
htmlformatted = df_styled.to_html()
with open(outloc / f"{id}_data.html", "w") as f:
f.write(htmlformatted)