Prophet fails with OutOfBoundsDatetime on dates outside `datetime64[ns]` range
Nobody has claimed this yet.
- #2690 by @NikhithReddyScripts — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start in forecaster.py at line 1136 and run the issue's minimal reproduction with the listed Prophet, pandas, and Python versions. Determine whether the supported outcome is graceful handling or a clear date-range error, then verify that dates outside the datetime64[ns] range no longer produce an uninformative OutOfBoundsDatetime crash.
Written by the indexing model from the issue text.
Description
Summary
Prophet crashes when processing dates outside the datetime64[ns] range, even though these dates could be valid with lower precision datetime types.
Expected Behavior
Prophet should either:
- Handle dates gracefully by using appropriate precision, or
- Provide a clear error message about supported date ranges
Actual Behavior
Prophet crashes with OutOfBoundsDatetime exception.
Minimal Reproduction
from prophet import Prophet
import pandas as pd
# Prophet crashes on dates outside datetime64[ns] range
df = pd.DataFrame({
'ds': ['3969-12-02', '3969-12-03'],
'y': [1.0, 2.0]
})
model = Prophet()
model.fit(df) # Fails with OutOfBoundsDatetime
Error Output
pandas._libs.tslibs.np_datetime.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 3969-12-02, at position 0
Root Cause
The issue occurs in forecaster.py:1136:
self.history_dates = pd.to_datetime(pd.Series(df['ds'].unique(), name='ds')).sort_values()
Prophet internally converts all datetime inputs to datetime64[ns] regardless of the input format or required precision. This hardcoded conversion fails for dates outside the nanosecond timestamp range.
Environment
- Prophet version: 1.1.7
- Pandas version: 2.3.1
- Python version: 3.12.9
- Dominant language
- Python
- Stars
- 20.5k
- Forks
- 4.6k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebook/prophet
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Linux x86-64 wheel: overlapping ELF load pages in prophet_model.bin on Linux 4.18 kernelsPossibly taken @nicolasdalsass claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
make_future_dataframe returns 1970 dates when `ds` is an integer columnPossibly taken @k0nnect claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
model_to_json drops the fitted regressor predictor; deserialized model can't predictPossibly taken @caiotheodoro claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
plot_components fails for logistic models with minmax scaling and no floorPossibly taken @RaphaelFakhri claimed this 38 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in facebook/prophet
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day