Prophet Forecasting in Python — Core Concepts
What Prophet does differently
Classical models like ARIMA treat a time series as one thing to model. Prophet takes a decomposition-first approach: it models the time series as the sum of separate components.
y(t) = g(t) + s(t) + h(t) + ε(t)
- g(t) — the trend (growth over time)
- s(t) — seasonal effects (weekly, yearly, or custom cycles)
- h(t) — holiday effects (irregular events)
- ε(t) — noise the model cannot explain
This additive structure means each component can be understood, plotted, and tuned independently.
Getting started
Prophet expects a DataFrame with exactly two columns: ds (datestamp) and y (the value):
from prophet import Prophet
import pandas as pd
df = pd.DataFrame({
"ds": pd.date_range("2020-01-01", periods=1000, freq="D"),
"y": sales_data,
})
model = Prophet()
model.fit(df)
future = model.make_future_dataframe(periods=90)
forecast = model.predict(future)
The forecast DataFrame contains yhat (prediction), yhat_lower, and yhat_upper (uncertainty bounds) along with each component.
Trend modeling
Prophet offers two trend models:
- Linear growth (default) — a piecewise linear function that can change slope at detected changepoints.
- Logistic growth — for metrics that saturate (like market penetration). You provide a carrying capacity (
cap) and optionally a floor.
# Logistic growth with saturation
df["cap"] = 10_000 # maximum possible value
df["floor"] = 0
model = Prophet(growth="logistic")
model.fit(df)
Changepoints
Prophet automatically detects points where the trend shifts. You can control this behavior:
model = Prophet(
changepoint_prior_scale=0.05, # lower = less flexible trend
n_changepoints=25, # number of potential changepoints
changepoint_range=0.8, # only look in first 80% of data
)
A common mistake is setting changepoint_prior_scale too high, which causes the trend to overfit to noise.
Seasonality
Prophet models seasonality using Fourier series — smooth, periodic functions that can capture any repeating pattern:
- Yearly seasonality — enabled by default for daily data with 2+ years
- Weekly seasonality — enabled by default for daily data with 2+ weeks
- Custom seasonality — you can add any period
# Add monthly seasonality
model.add_seasonality(name="monthly", period=30.5, fourier_order=5)
The fourier_order controls how wiggly the seasonal pattern is. Higher values capture more complex patterns but risk overfitting.
Holiday effects
Prophet lets you specify known events that affect your metric:
holidays = pd.DataFrame({
"holiday": "black_friday",
"ds": pd.to_datetime(["2023-11-24", "2024-11-29", "2025-11-28"]),
"lower_window": -1, # effect starts 1 day before
"upper_window": 1, # effect lasts 1 day after
})
model = Prophet(holidays=holidays)
For US holidays, Prophet includes built-in country holiday lists:
model.add_country_holidays(country_name="US")
When to choose Prophet
| Situation | Prophet | ARIMA |
|---|---|---|
| Daily business metrics | Excellent | Good with SARIMA |
| Multiple seasonal patterns | Built-in | Manual Fourier terms |
| Missing data points | Handles gracefully | Requires imputation |
| Analyst with limited stats background | Easy to use | Requires parameter expertise |
| Sub-daily data | Less tested | Works well |
| Tiny datasets (< 50 points) | Unreliable | Better suited |
Prophet excels at business forecasting with daily or weekly data, strong seasonality, and known events. It is less suited for high-frequency data, very short series, or domains where interpretable coefficients matter.
Common misconception
People assume Prophet is always better than ARIMA because it is newer and from a big tech company. In benchmarks like the M4 competition, simple exponential smoothing methods often outperform Prophet on many datasets. Prophet’s strength is not raw accuracy — it is usability, built-in handling of holidays, and interpretable components.
The one thing to remember: Prophet trades statistical rigor for practical usability — it handles messy business data, holidays, and multiple seasons out of the box, making it the fastest path from raw data to useful forecast for most business applications.
See Also
- Python Arima Forecasting How ARIMA models use patterns in past numbers to predict the future, explained like a bedtime story.
- Python Autocorrelation Analysis How today's number is connected to yesterday's, and why that connection is the secret weapon of time series analysis.
- Python Exponential Smoothing How exponential smoothing weighs recent events more heavily to predict what happens next, like trusting fresh memories more than old ones.
- Python Multivariate Time Series Why tracking multiple things at once gives you better predictions than tracking each one alone.
- Python Seasonal Decomposition How Python breaks apart time data into trend, seasonal patterns, and leftover noise — like separating ingredients in a smoothie.