make_future_dataframe returns 1970 dates when `ds` is an integer column

Open Beginner friendly
#2,792 0 comments 0 reactions 0 assignees View on GitHub

@k0nnect is already working on this.

Since Nov 24, 2026.

  • #2793 by @k0nnect — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
pandas, python
Domain
data

Research direction

Run the minimal repro and compare m.history['ds'] after fit() with the frame returned by make_future_dataframe(); the history is parsed correctly while the future frame is not. Trace make_future_dataframe and the integer-ds conversion used during fitting, then make the future dates continue from 2024-03-01. Done when the repro prints 2024-03-01 through 2024-03-03 and the integer-year case with freq="YS" continues from 2020.

Written by the indexing model from the issue text.

Description

what happens

when the ds column holds integers (for example 20240101 from a csv of YYYYMMDD dates, or plain integer years like 2019), fit() reads them as dates and trains on the right dates. make_future_dataframe() on the same model does not: it returns timestamps in 1970, and predict() on that frame then forecasts for 1970. no error or warning is raised.

expected

make_future_dataframe() should continue from the last date the model was fitted on, the same as it does when ds holds strings or datetimes.

minimal repro

import logging

import pandas as pd
import prophet
from prophet import Prophet

logging.getLogger("cmdstanpy").setLevel(logging.ERROR)
logging.getLogger("prophet").setLevel(logging.ERROR)

print("prophet", prophet.__version__, "pandas", pd.__version__)

# daily data whose dates are stored as YYYYMMDD integers, which is what
# pd.read_csv gives for a column like 20240101,20240102,...
dates = pd.date_range("2024-01-01", periods=60, freq="D")
df = pd.DataFrame({
    "ds": dates.strftime("%Y%m%d").astype("int64"),
    "y": [float(i % 7) for i in range(60)],
})
print("ds dtype:", df["ds"].dtype, "first:", df["ds"].iloc[0], "last:", df["ds"].iloc[-1])

m = Prophet().fit(df)
print("history ds range:", m.history["ds"].min(), "->", m.history["ds"].max())

future = m.make_future_dataframe(periods=3, include_history=False)
print("make_future_dataframe(periods=3, include_history=False):")
print(future)

forecast = m.predict(future)
print("forecast dates:", forecast["ds"].dt.strftime("%Y-%m-%d").tolist())

output:

prophet 1.5.0 pandas 3.1.1
ds dtype: int64 first: 20240101 last: 20240229
history ds range: 2024-01-01 00:00:00 -> 2024-02-29 00:00:00
make_future_dataframe(periods=3, include_history=False):
                             ds
0 1970-01-02 00:00:00.020240229
1 1970-01-03 00:00:00.020240229
2 1970-01-04 00:00:00.020240229
forecast dates: ['1970-01-02', '1970-01-03', '1970-01-04']

the history is right (2024-01-01 to 2024-02-29), but the future frame starts on 1970-01-02 instead of 2024-03-01.

the same happens with integer years: ds = [2000, 2001, ..., 2019] fits on 2000-01-01 to 2019-01-01, and make_future_dataframe(periods=2, freq="YS", include_history=False) returns 1971-01-01 00:00:00.000002019 and 1972-01-01 00:00:00.000002019.

impact

the usual forecasting flow (fit, make_future_dataframe, predict) runs to the end without any error and gives a forecast for the wrong dates. integer ds values are handled on purpose when fitting and predicting (they are converted to strings before parsing, added for #675), so this looks like one place where the dates kept for make_future_dataframe are parsed differently from the dates used for fitting.

versions

  • prophet 1.5.0 from pypi, and main at 5cf15c0
  • pandas 3.1.1, numpy 2.5.5, cmdstanpy 1.3.2
  • python 3.12, macos arm64
Dominant language
Python
Stars
20.5k
Forks
4.6k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/prophet

All issues in facebook/prophet

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.