From 4df584de2f9ed9384f3dde1237f9ec6b634205f4 Mon Sep 17 00:00:00 2001 From: Maxi <167797320+1106maxi@users.noreply.github.com> Date: Wed, 30 Sep 2026 14:24:53 +0200 Subject: [PATCH 1/2] fix: use .iloc for positional Series access (pandas 3 compatibility) Fix KeyError: 0 on pandas 3.x by using .iloc[0] for positional access --- sensemakr/sensitivity_plots.py | 2 +- sensemakr/sensitivity_statistics.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sensemakr/sensitivity_plots.py b/sensemakr/sensitivity_plots.py index 51890f5..ee2f9fd 100644 --- a/sensemakr/sensitivity_plots.py +++ b/sensemakr/sensitivity_plots.py @@ -624,7 +624,7 @@ def extract_from_model(model, treatment, benchmark_covariates, kd, ky, r2dz_x, r se = model_data['se'] dof = model_data['dof'] try: - estimate, se = float(estimate), float(se) + estimate, se = float(estimate.iloc[0]), float(se.iloc[0]) except: sys.exit('Error: The estimated effect and standard error must be numeric.') diff --git a/sensemakr/sensitivity_statistics.py b/sensemakr/sensitivity_statistics.py index 1551680..0d2f057 100644 --- a/sensemakr/sensitivity_statistics.py +++ b/sensemakr/sensitivity_statistics.py @@ -174,7 +174,7 @@ def partial_r2(model=None, covariates=None, t_statistic=None, dof=None): model_data = model_helper(model, covariates=covariates) t_statistic = model_data['t_statistics'] dof = model_data['dof'] - return (t_statistic ** 2 / (t_statistic ** 2 + dof))[0] # extracts float + return (t_statistic ** 2 / (t_statistic ** 2 + dof)).iloc[0] # extracts float else: return t_statistic ** 2 / (t_statistic ** 2 + dof) From 2a66d6f05a598cdb1c8e024ee27aeb329e973e4e Mon Sep 17 00:00:00 2001 From: Maxi <167797320+1106maxi@users.noreply.github.com> Date: Wed, 30 Sep 2026 14:24:55 +0200 Subject: [PATCH 2/2] Update .gitignore --- .gitignore | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 603dc16..92c5123 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,29 @@ -.idea +# Python __pycache__/ +*.py[cod] + +# Virtual environments +.venv/ +venv/ + +# Packaging / build artifacts +*.egg-info/ +build/ +dist/ + +# Testing and coverage +.pytest_cache/ +.coverage +.coverage.* +htmlcov/ +coverage.xml + +# Jupyter .ipynb_checkpoints + +# Editors / IDEs +.idea/ +.vscode/ + +# Project specific backup/