Prophet

1.3.0 · active · verified Thu Apr 09

Prophet is an automatic forecasting procedure developed by Facebook. It is designed for analyzing time series that exhibit strong seasonal effects and has several seasons of historical data. The current version is 1.3.0, and it maintains a regular release cadence with frequent updates and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple Prophet model, fit it to a Pandas DataFrame, generate a future DataFrame, and make predictions. The input DataFrame must have columns named 'ds' (datetime) and 'y' (numerical value).

import pandas as pd
from prophet import Prophet

# Create a sample DataFrame with 'ds' (datetime) and 'y' (value) columns
data = {
    'ds': pd.to_datetime(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04', '2017-01-05',
                          '2017-01-06', '2017-01-07', '2017-01-08', '2017-01-09', '2017-01-10']),
    'y': [10, 12, 15, 13, 17, 18, 20, 22, 25, 23]
}
df = pd.DataFrame(data)

# Instantiate and fit the Prophet model
model = Prophet()
model.fit(df)

# Create a future DataFrame for predictions (e.g., next 3 days)
future = model.make_future_dataframe(periods=3)

# Make predictions
forecast = model.predict(future)

# Print the last few rows of the forecast
print(forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail())

view raw JSON →