diff --git a/2026-07-11_01.png b/2026-07-11_01.png new file mode 100644 index 0000000..8c4cdef Binary files /dev/null and b/2026-07-11_01.png differ diff --git a/analyze_lab_placement_survey.py b/analyze_lab_placement_survey.py index 1d9a8e8..618187c 100755 --- a/analyze_lab_placement_survey.py +++ b/analyze_lab_placement_survey.py @@ -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)