Skip to content

Commit a338b7f

Browse files
authored
fix(compat): handle zero offset in shift_array (#480)
1 parent 87d1430 commit a338b7f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

mlforecast/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "1.0.1"
1+
__version__ = "1.0.2"
22
__all__ = ['MLForecast']
33
from mlforecast.forecast import MLForecast

mlforecast/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def __init__(self, *args, **kwargs): # noqa: ARG002
4141
def shift_array(x, offset):
4242
if offset >= x.size or offset < 0:
4343
return np.full_like(x, np.nan)
44+
if offset == 0:
45+
return x.copy()
4446
out = np.empty_like(x)
4547
out[:offset] = np.nan
4648
out[offset:] = x[:-offset]

nbs/compat.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
" def shift_array(x, offset):\n",
5656
" if offset >= x.size or offset < 0:\n",
5757
" return np.full_like(x, np.nan)\n",
58+
" if offset == 0:\n",
59+
" return x.copy()\n",
5860
" out = np.empty_like(x)\n",
5961
" out[:offset] = np.nan\n",
6062
" out[offset:] = x[:-offset]\n",

settings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ author = José Morales
88
author_email = [email protected]
99
copyright = Nixtla
1010
branch = main
11-
version = 1.0.1
11+
version = 1.0.2
1212
min_python = 3.9
1313
audience = Developers
1414
language = English
@@ -23,7 +23,7 @@ aws_requirements = fsspec[s3]
2323
gcp_requirements = fsspec[gcs]
2424
azure_requirements = fsspec[adl]
2525
polars_requirements = polars[numpy]
26-
dev_requirements = black>=24 datasetsforecast>=1 gitpython holidays<0.21 lightgbm matplotlib mlflow>=2.10.0 mypy nbdev<2.3.26 numpy>=2 pandas>=2.2.2 pre-commit polars[numpy] pyarrow ruff setuptools statsmodels xgboost
26+
dev_requirements = black>=24 datasetsforecast>=1 gitpython holidays<0.21 lightgbm<4.6 matplotlib mlflow>=2.10.0 mypy nbdev<2.3.26 numpy>=2 pandas>=2.2.2 pre-commit polars[numpy] pyarrow ruff setuptools statsmodels xgboost
2727
nbs_path = nbs
2828
doc_path = _docs
2929
recursive = True

0 commit comments

Comments
 (0)