Compare commits

..

2 Commits

Author SHA1 Message Date
takahiro 5de1073bd5 Merge branch 'review-kayano' 2026-07-11 19:35:56 +09:00
takahiro 730b21f73d Review and fix placement survey analysis 2026-07-11 19:35:40 +09:00
2 changed files with 13 additions and 7 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

+13 -7
View File
@@ -31,10 +31,11 @@ def extract_values_from_body(body):
m = re.search(r"^値\s+カウント\s*$", body, flags=re.MULTILINE)
if m:
table_part = body[m.end() :]
table_part = body[m.end():]
count_rows = re.findall(
r"^\s*(-?\d+(?:\.\d+)?)\s+(\d+)\s*$", table_part, flags=re.MULTILINE
r"^\s*(-?\d+(?:\.\d+)?)\s+(\d+)\s*$", table_part,
flags=re.MULTILINE
)
values = []
@@ -103,7 +104,7 @@ def parse_google_form_results(text):
if not m:
raise ValueError("個別研究室ブロックが見つかりません")
text = text[m.start() :]
text = text[m.start():]
# 各研究室ブロックを取得
pattern = re.compile(
@@ -378,7 +379,8 @@ def annotate_target_values(ax, target_values, color):
rotation=90,
color=color,
fontsize=9,
bbox={"facecolor": "white", "edgecolor": "none", "alpha": 0.75, "pad": 1.2},
bbox={"facecolor": "white", "edgecolor": "none",
"alpha": 0.75, "pad": 1.2},
)
@@ -444,7 +446,8 @@ def plot_data(data, lower=10, upper=None, target_lab=10, bin_width=10):
df = filter_plot_data(df, lower=lower, upper=upper)
labs = sorted(df["研究室番号"].unique())
target_values = df.loc[df["研究室番号"] == target_lab, ""].to_numpy(dtype=float)
target_values = df.loc[df["研究室番号"] ==
target_lab, ""].to_numpy(dtype=float)
apply_plot_style()
colors = plt.get_cmap("tab10").colors
@@ -459,7 +462,8 @@ def plot_data(data, lower=10, upper=None, target_lab=10, bin_width=10):
)
draw_lab_boxplot(axs[0], df, labs, colors[0], rng)
draw_gp_histogram(axs[1], df, target_values, bin_width, colors[0], colors[3])
draw_gp_histogram(axs[1], df, target_values,
bin_width, colors[0], colors[3])
for ax in axs:
style_axis(ax)
@@ -467,6 +471,7 @@ def plot_data(data, lower=10, upper=None, target_lab=10, bin_width=10):
plt.show()
return fig, axs
def main():
parser = argparse.ArgumentParser(
description="Google Forms のコピペ結果から研究室別GPを集計する"
@@ -491,7 +496,8 @@ def main():
text = f.read()
df = parse_google_form_results(text)
df_r = summarize_by_lab(df).sort_values(by="GP mean", ascending=False)
# df_r = summarize_by_lab(df).sort_values(by="GP mean", ascending=False)
df_r = summarize_by_lab(df)
print_summary(df, df_r)