Skip to content

fix: validate periods is non-negative in make_future_dataframe - #2765

Open
Roxen-AS wants to merge 1 commit into
meta:mainfrom
Roxen-AS:fix/make-future-dataframe-negative-periods
Open

Roxen-AS wants to merge 1 commit into
meta:mainfrom
Roxen-AS:fix/make-future-dataframe-negative-periods

Conversation

@Roxen-AS

Copy link
Copy Markdown

Description

When calling \make_future_dataframe(periods=...)\ with a negative integer (e.g. \periods=-1), \pd.date_range\ raises an unhandled low-level \OverflowError: Python integer -1 out of bounds for uint64.

This PR adds eager input validation for \periods:

  • Validates that \periods\ is an integer and non-negative (\periods >= 0).
  • Raises \ValueError('periods must be a non-negative integer.')\ if invalid.
  • Adds regression unit test in \python/prophet/tests/test_prophet.py.

When periods < 0 is passed to make_future_dataframe, pandas date_range fails with an unhandled OverflowError (integer out of bounds for uint64). Validate periods eagerly and raise a clear ValueError.

Signed-off-by: Roxen-AS <akash.arjun12@gmail.com>
@meta-cla meta-cla Bot added the CLA Signed label Oct 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant