Blog Post

Data Science Community Blog
9 MIN READ

Forecasting With Confidence using Prophet for Data Science in Microsoft Fabric

Sahir_Maharaj's avatar
Sahir_Maharaj
Icon for Super User rankSuper User
24 days ago

If you have worked with time series data for any amount of time, you know this feeling. You build a forecast that looks great on paper, everything lines up nicely, and then reality shows up and does its own thing. You cleaned the data, plotted the trend, maybe even smoothed it a bit, and still the future refused to cooperate. A seasonal pattern shifted. A random spike appeared out of nowhere. Someone from the business asked why the forecast missed the mark, and suddenly the model felt less like science and more like guesswork. I have been there more times than I can count. Most data professionals have. This is usually the point where people either overcomplicate things or lose confidence in forecasting altogether. But there is a middle ground. A place where models are structured, but still flexible enough to deal with real-world messiness. That is exactly where the Prophet forecasting model tends to click for people.

What you will learn: In this edition, we’re exploring how Prophet actually thinks about time. By the end, you should have a much clearer sense of how trends, seasonality, and real-world disruptions fit together, and why that framing often matters more than complex math. We will also explore interpretation, because getting numbers is easy, but knowing what they really mean is where the real value shows up.

Read Time: 9 minutes

Source: Sahir Maharaj (https://sahirmaharaj.com)

Prophet was built to solve a frustration you have probably already felt, and one I still see in my own work. Traditional forecasting approaches often assume the world behaves in neat, predictable ways. In real businesses, that almost never happens. Growth speeds up, slows down, pauses, or changes direction entirely. Prophet starts from the assumption that change is normal, not something unusual that needs to be explained away. One thing I appreciate about Prophet is how it mirrors the way people already think. Instead of treating time as a single abstract curve, it breaks things into pieces you recognize. There is a long-term trend. There are recurring patterns that show up every week or every year. And then there are disruptions that everyone knows exist, even if they are hard to model. Over time, you realize that forecasting is not just about being accurate. It is about being believable. This is something I learned after a few painful conversations with stakeholders.

Prophet helps with this because you can explain what the model is doing in plain language. You are not hiding behind formulas. You are talking about growth, cycles, and change. That makes a big difference when you are sharing results. Instead of showing a single line that stretches into the future, you can talk through why certain periods look stronger or weaker. In my experience, that shift alone changes how people respond to forecasts. The conversation becomes collaborative instead of defensive. Eventually, this changes how you think as well. I stopped obsessing over squeezing out tiny accuracy improvements and started paying more attention to whether the story made sense. What forces are really driving this series. Which patterns feel stable. Which ones feel fragile. At that point, Prophet stops feeling like just another tool. It becomes a way of structuring how you reason about time, uncertainty, and business behavior. That mindset tends to stick with you long after the model itself.

import pandas as pd
import numpy as np
from prophet import Prophet
import matplotlib.pyplot as plt

np.random.seed(42)

dates = pd.date_range(start="2026-01-01", end="2032-12-31", freq="D")
trend = np.linspace(25, 95, len(dates))
weekly = 4 * np.sin(2 * np.pi * dates.dayofweek / 7)
yearly = 10 * np.sin(2 * np.pi * dates.dayofyear / 365.25)
noise = np.random.normal(0, 2.5, len(dates))

values = trend + weekly + yearly + noise

df = pd.DataFrame({
    "ds": dates,
    "y": values
})

model = Prophet(
    yearly_seasonality=True,
    weekly_seasonality=True,
    daily_seasonality=False
)

model.fit(df)

future = model.make_future_dataframe(periods=730)
forecast = model.predict(future)

fig, axes = plt.subplots(3, 1, figsize=(14, 12), sharex=True)

axes[0].plot(df["ds"], df["y"], color="black", alpha=0.6)
axes[0].plot(forecast["ds"], forecast["yhat"], color="blue")
axes[0].set_title("Observed Data vs Prophet Forecast (2026 and Beyond)")

axes[1].plot(forecast["ds"], forecast["trend"], color="green")
axes[1].set_title("Long-Term Trend Learned by Prophet")

axes[2].plot(forecast["ds"], forecast["weekly"], label="Weekly", color="purple")
axes[2].plot(forecast["ds"], forecast["yearly"], label="Yearly", color="orange")
axes[2].legend()
axes[2].set_title("Seasonal Components Driving the Forecast")

plt.tight_layout()
plt.show()

Before any forecast has a chance of being useful, the data needs to be solid. This is where pandas quietly does most of the heavy lifting. Time series data often looks straightforward until you look closely. Missing dates, duplicate records, and uneven intervals show up more often than people expect. As you gain experience, you start to realize that forecasting is mostly data work. Getting dates right is not just a technical detail. It shapes how the model understands time. Deciding how to aggregate data forces you to think about what actually matters. In my own projects, this is often where the real decisions happen. I find that what makes pandas so helpful is how transparent it is. You can see every step. You can check assumptions as you go. If something looks odd, you can stop and fix it before it quietly affects the forecast.

Source: Sahir Maharaj (https://sahirmaharaj.com)

There is also a natural fit between pandas and Prophet. Both expect data to be clean, structured, and explicit about time. That alignment removes friction and lets you focus on understanding the series rather than wrestling with formats. For people newer to forecasting, pandas makes the process feel less intimidating. Everything stays in tables you already understand. For more experienced practitioners, it offers control and flexibility. I have found that this balance encourages experimentation without chaos. By the time Prophet comes into play, pandas has already shaped the outcome. The forecast reflects the choices you made earlier. Recognizing that pushes you toward better data habits, which is where forecasting maturity really comes from.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(21)

dates = pd.date_range(start="2026-01-01", end="2030-12-31", freq="D")
signal = 40 + np.sin(2 * np.pi * dates.dayofyear / 365.25) * 7
noise = np.random.normal(0, 4, len(dates))
values = signal + noise

raw = pd.DataFrame({
    "date": dates,
    "value": values
})

raw["month"] = raw["date"].dt.to_period("M")
monthly = raw.groupby("month")["value"].mean().reset_index()
monthly["month"] = monthly["month"].dt.to_timestamp()

fig, ax1 = plt.subplots(figsize=(14, 6))

ax1.bar(raw["date"], raw["value"], width=1, alpha=0.15)
ax1.set_ylabel("Daily Signal")

ax2 = ax1.twinx()
ax2.plot(monthly["month"], monthly["value"], color="red", linewidth=3)
ax2.set_ylabel("Monthly Aggregated Signal")

plt.title("Same Data, Different Story: pandas Aggregation in a 2026+ Timeline")
plt.show()

Creating a forecast can feel like crossing the finish line. The plot looks smooth. The future appears mapped out. But this is actually where the most important work begins. Interpretation is what turns a forecast into something useful. When you look at a Prophet forecast closely, you start noticing which forces matter most. Sometimes seasonality dominates everything else. Other times the long-term trend is doing most of the work. Seeing this helps you understand why the model is behaving the way it is. Uncertainty is a big part of this story. As forecasts stretch further into the future, confidence naturally drops. Prophet makes that visible instead of hiding it. In my experience, being upfront about uncertainty builds more trust, not less.

This also changes how you talk about results. Instead of presenting forecasts as promises, you start framing them as possibilities. That aligns much better with how real decisions are made. People rarely need exact numbers. They need a sense of direction and risk. Over time, this process sharpens your intuition. By comparing forecasts to what actually happens, you get better at spotting patterns that hold and ones that break. Prophet becomes less about prediction and more about learning. That is where your value really grows. You are no longer just producing outputs. You are helping others understand what the future might look like and how confident they should be about it.

import pandas as pd
import numpy as np
from prophet import Prophet
import matplotlib.pyplot as plt

np.random.seed(88)

dates = pd.date_range(start="2026-01-01", end="2031-12-31", freq="D")
base = 55 + np.linspace(0, 25, len(dates))
season = 9 * np.sin(2 * np.pi * dates.dayofyear / 365.25)
noise = np.random.normal(0, 5, len(dates))

y = base + season + noise

df = pd.DataFrame({
    "ds": dates,
    "y": y
})

model = Prophet(interval_width=0.9)
model.fit(df)

future = model.make_future_dataframe(periods=1095)
forecast = model.predict(future)

plt.figure(figsize=(14, 6))

plt.plot(df["ds"], df["y"], color="black", alpha=0.5)
plt.plot(forecast["ds"], forecast["yhat"], color="blue")
plt.fill_between(
    forecast["ds"],
    forecast["yhat_lower"],
    forecast["yhat_upper"],
    color="blue",
    alpha=0.25
)

plt.title("Forecast Uncertainty Grows the Further You Look Ahead (2026–2034)")
plt.xlabel("Date")
plt.ylabel("Value")
plt.show()

One of the most valuable skills you can build with forecasting is knowing when a model is a good fit and when it is not. Prophet is powerful, but it is not magic. I have seen it shine in some situations and struggle badly in others. Learning to spot that early saves you time, credibility, and frustration. Prophet works best when there is a clear structure in the data. If your time series has an underlying trend and some kind of repeating behavior, even if it is noisy, Prophet usually has something to work with. This is common in many business scenarios like demand, usage, traffic, or revenue. When those patterns exist, the model feels almost intuitive in how it responds. Where things start to break down is when the data is mostly chaos. If there is no real signal, no consistency, and no stable process behind the numbers, Prophet cannot invent meaning.

Source: Sahir Maharaj (https://sahirmaharaj.com)

In those cases, the forecast might look reasonable on the surface, but it is not grounded in anything real. I have learned to be cautious when forecasts look too confident on weak data. Another limitation shows up when behavior changes abruptly and permanently. Prophet can handle gradual trend changes well, but sudden regime shifts are harder. Think of a product launch that completely changes usage patterns, or a policy change that alters behavior overnight. In these situations, the model often needs help, either through shorter training windows or careful interpretation. This is where judgment matters more than tooling. Knowing the story behind the data is just as important as fitting the model.

I have found that the best forecasts come from pairing Prophet with domain understanding, not from blindly trusting the output. There is also a temptation to overuse forecasting. Just because you can forecast something does not always mean you should. Sometimes the most honest answer is that the future is too uncertain to model meaningfully. Being able to say that, and explain why, is a sign of maturity as a data professional. When you develop this instinct, Prophet becomes safer to use. You stop asking whether the model can produce a forecast and start asking whether the forecast should be trusted. That question changes everything. Ultimately, this objective is about restraint. High-value forecasting is not about showing off models. It is about choosing the right tool at the right time and being honest about its limits.

Source: Sahir Maharaj (https://sahirmaharaj.com)

And there it is... forecasting does not have to feel intimidating or overly theoretical. You do not need a perfect dataset or a complex setup to get value out of Prophet. Starting small is often the best move. Pick a simple time series you already understand, run a forecast, and spend time just looking at how the model thinks. That alone can unlock a lot of insight and confidence. As you experiment, try to stay curious rather than critical. Some forecasts will land nicely. Others will miss. That is normal. Every miss teaches you something about the data, the process, or the assumptions you made along the way. And if you ever feel stuck, unsure, or just want a second opinion, reach out. Seriously. I am always more than happy to help!

Thanks for taking the time to read my post! I’d love to hear what you think and connect with you! 🙂

About the author

Source: Sahir Maharaj

 

 

 

 

 

 

Sahir Maharaj is a Lead Data Scientist who leads the design and deployment of end-to-end AI solutions that drive strategic decisions at scale. As a Microsoft MVP, he has been featured internationally, including in The Indian Express and on New York's Times Square billboards, and is a prolific content creator on LinkedIn.

Updated 24 days ago
Version 1.0
No CommentsBe the first to comment