From 45f8e2e255ff8ea7c97f6a5f9be894eefbb3394b Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Tue, 16 Apr 2024 18:04:53 +0100 Subject: [PATCH] DOC: Update for release 6.0 --- ci/install-posix.sh | 3 +-- doc/source/changes/6.0.rst | 21 +++++++++++++++++++++ linearmodels/iv/results.py | 2 +- linearmodels/panel/model.py | 2 +- linearmodels/panel/results.py | 2 +- linearmodels/tests/panel/test_data.py | 6 +++--- linearmodels/tests/panel/test_formula.py | 2 +- requirements-dev.txt | 4 ++-- requirements-test.txt | 4 ++-- requirements.txt | 3 +-- 10 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 doc/source/changes/6.0.rst diff --git a/ci/install-posix.sh b/ci/install-posix.sh index d180d86e00..5c0708b8c9 100644 --- a/ci/install-posix.sh +++ b/ci/install-posix.sh @@ -17,6 +17,5 @@ eval "$CMD" if [ "${PIP_PRE}" = true ]; then python -m pip uninstall -y numpy pandas scipy matplotlib statsmodels xarray - python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy pandas scipy matplotlib xarray --upgrade --use-deprecated=legacy-resolver - python -m pip install git+https://github.com/statsmodels/statsmodels.git --upgrade --no-build-isolation -v + python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy pandas scipy matplotlib xarray statsmodels --upgrade --use-deprecated=legacy-resolver fi diff --git a/doc/source/changes/6.0.rst b/doc/source/changes/6.0.rst new file mode 100644 index 0000000000..594ee03edb --- /dev/null +++ b/doc/source/changes/6.0.rst @@ -0,0 +1,21 @@ +Version 6.0 +------------ + +* Increased minimums: + + - Python: 3.9 + - formulaic: 1.0.0 + - NumPy: 1.22.3 + - SciPy: 1.8.0 + - pandas: 1.4.0 + - statsmodels: 0.13.0 + +* The key feature of this release is compatibility with NumPy 2. linearmodels + wheels are built using NumPy 2.0.0rc1 (or later) and can run on any version + of NumPy 1.22.3 or later, including NumPy 2.0.0. +* Improved compatibility with fuure changes in pandas 3.0.0. + +.. note:: + + In order to use NumPy 2, the environment must consist of packages + that have been built against NumPy 2.0.0rc1 or later. diff --git a/linearmodels/iv/results.py b/linearmodels/iv/results.py index 2ee79b01ad..3916e40591 100644 --- a/linearmodels/iv/results.py +++ b/linearmodels/iv/results.py @@ -516,7 +516,7 @@ def _out_of_sample( ) pred = self.model.predict(self.params, exog=exog, endog=endog, data=data) if not missing: - pred = pred.loc[pred.notnull().all(1)] + pred = pred.loc[pred.notnull().all(axis=1)] return pred def predict( diff --git a/linearmodels/panel/model.py b/linearmodels/panel/model.py index 438896b4bf..ef52bda00c 100644 --- a/linearmodels/panel/model.py +++ b/linearmodels/panel/model.py @@ -3055,7 +3055,7 @@ def single(z: DataFrame) -> Series: else: avg_adj_r2 = np.nan all_params = all_params.iloc[:, 1:-2] - params = np.asarray(all_params.mean(0).values[:, None], dtype=float) + params = np.asarray(all_params.mean(axis=0).values[:, None], dtype=float) wy = np.asarray(wy_df) wx = np.asarray(wx_df) diff --git a/linearmodels/panel/results.py b/linearmodels/panel/results.py index 40d9510a0e..b7a10c477b 100644 --- a/linearmodels/panel/results.py +++ b/linearmodels/panel/results.py @@ -488,7 +488,7 @@ def _out_of_sample( ) pred = self.model.predict(self.params, exog=exog, data=data, context=context) if not missing: - pred = pred.loc[pred.notnull().all(1)] + pred = pred.loc[pred.notnull().all(axis=1)] return pred def predict( diff --git a/linearmodels/tests/panel/test_data.py b/linearmodels/tests/panel/test_data.py index 95ff69778f..dee9f50319 100644 --- a/linearmodels/tests/panel/test_data.py +++ b/linearmodels/tests/panel/test_data.py @@ -400,13 +400,13 @@ def test_dummies(mi_df): data = PanelData(mi_df) edummy = data.dummies() assert edummy.shape == (77, 11) - assert np.all(edummy.sum(0) == 7) + assert np.all(edummy.sum(axis=0) == 7) tdummy = data.dummies(group="time") assert tdummy.shape == (77, 7) - assert np.all(tdummy.sum(0) == 11) + assert np.all(tdummy.sum(axis=0) == 11) tdummy_drop = data.dummies(group="time", drop_first=True) assert tdummy_drop.shape == (77, 6) - assert np.all(tdummy.sum(0) == 11) + assert np.all(tdummy.sum(axis=0) == 11) with pytest.raises(ValueError): data.dummies("unknown") diff --git a/linearmodels/tests/panel/test_formula.py b/linearmodels/tests/panel/test_formula.py index 2141ed47de..f8e02d044b 100644 --- a/linearmodels/tests/panel/test_formula.py +++ b/linearmodels/tests/panel/test_formula.py @@ -352,4 +352,4 @@ def test_escaped_variable_name(): ) mod = PanelOLS.from_formula("`var a` ~ 1", data=data) res = mod.fit() - assert_allclose(res.params, data.mean(0)) + assert_allclose(res.params, data.mean(axis=0)) diff --git a/requirements-dev.txt b/requirements-dev.txt index a2ebd84c58..5cf7e230d4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ xarray>=0.16 mypy>=1.3 -black[jupyter]==23.11.0 -pytest>=7.3.0 +black[jupyter]==24.4.0 +pytest>=7.3.0,<8 isort>=5.12 ipython matplotlib diff --git a/requirements-test.txt b/requirements-test.txt index 4bf98797cf..326fefc6e6 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,10 +1,10 @@ -black[jupyter]==23.11.0 +black[jupyter]==24.4.0 coverage flake8 isort colorama matplotlib -pytest>=7.3.0 +pytest>=7.3.0,<8 pytest-xdist pytest-cov seaborn diff --git a/requirements.txt b/requirements.txt index dfa07b8631..2050406585 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,10 @@ numpy>=1.22.3,<3 pandas>=1.4.0 scipy>=1.8.0 -statsmodels>=0.12.0 +statsmodels>=0.13.0 mypy_extensions>=0.4 Cython>=3.0.10 pyhdfe>=0.1 formulaic>=1.0.0 # versioning setuptools_scm[toml]>=8.0.0,<9.0.0 -