From 08606f21c7e311559b6f508ae92fbb75871e0b3f Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Thu, 3 Jul 2025 10:30:52 +0200 Subject: [PATCH] Remove Python 3.8 compat in .macro.extrapolate() - This version of Python is no longer supported. - Satisfy mypy with pandas-stubs 2.3.0. --- message_ix/macro.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/message_ix/macro.py b/message_ix/macro.py index 6946f5e8a..8dfc09b48 100644 --- a/message_ix/macro.py +++ b/message_ix/macro.py @@ -262,8 +262,6 @@ def extrapolate( The index does *not* have a ``year`` dimension; the data are implicitly for `ym1`. """ - from sys import version_info - from scipy.optimize import curve_fit def f(x, b, m): @@ -278,11 +276,8 @@ def fitted_intercept(df: pd.DataFrame) -> float: # Apply fitted_intercept to grouped data groupby_cols = set(model_data.columns) - {"year", "value"} - apply_kwargs = {"include_groups": False} if version_info.minor > 8 else {} result = ( - model_data.groupby(list(groupby_cols)) - .apply(fitted_intercept, **apply_kwargs) - .rename("value") + model_data.groupby(list(groupby_cols)).apply(fitted_intercept).rename("value") ) # Convert "commodity" and "level" to "sector"