TL;DR
Paste three years of sales into ChatGPT and you get confident numbers with no model behind them. This guide gives nine prompts that use ChatGPT for what it does well, writing, explaining and reviewing analysis code you run yourself, from data checks to backtests. A worked example on Mauna Loa CO2 data shows what good output looks like. The chatbot is a fine coding partner and a shaky fortune teller.
Start with these three:
Say an analyst pastes three years of monthly sales into ChatGPT and asks for next quarter’s forecast. The reply comes back in seconds: three confident numbers and a paragraph about seasonality. Nothing in it says how those numbers were produced, whether they beat a simple baseline, or how wrong they might be.
That is the main thing to know before using ChatGPT for time series analysis. ChatGPT is a language model, not a forecasting model, so the useful prompts ask it to write, explain and review analysis code that you run and check, not to produce forecasts from pasted numbers. The 9 prompts below follow that rule, from checking the data to backtesting and explaining results, and the article ends with a worked Python example, with its real output, of the code those prompts should lead to.
Key Takeaways
- A large language model predicts text. When it “forecasts” from pasted numbers, it is not fitting a statistical model unless it writes and runs code.
- Use ChatGPT to write analysis code, explain methods and review your code for mistakes. Run the code yourself, or inspect the code it runs in its data analysis tool.
- Every forecast needs a baseline. In our example on the Mauna Loa CO2 data, Holt-Winters had a mean absolute error of 0.24 ppm against 1.88 ppm for a seasonal naive forecast.
- Give the model context it cannot guess: the frequency, the forecast horizon, what the series measures and what decision the forecast supports.
- Ask for uncertainty, not just point forecasts, and judge models by backtests on held-out data.
What Can ChatGPT Do With Time Series Data?
Time series analysis is the study of data recorded in time order, such as daily sales, hourly sensor readings or monthly prices, to find trends, seasonal patterns and unusual points and to forecast future values. ChatGPT can help with almost every step, as long as the numbers come from code.
When you paste a column of numbers and ask for a forecast, the model reads them as text. It may spot a rough pattern, but it can misread long lists, make arithmetic slips, and produce forecasts that look plausible with no fitted model behind them. That is the core limit: an LLM is not a forecasting model.
ChatGPT’s data analysis feature changes the picture in one important way. According to OpenAI’s help article on data analysis, ChatGPT can write and run Python on files you upload, and OpenAI advises checking the generated code, outputs and assumptions before relying on a result. When numbers come from code you can read, you can check them. When they come from the model’s reply alone, you cannot.
The 9 Prompts
Each prompt below is written to be copied and edited. Replace the bracketed parts with your own details. They work best in order, in one conversation, so the model keeps the context of your data.
Prompt 1: Describe the Data and Check Its Quality
I have a time series in a CSV with columns [date, value]. It records [daily
orders for an online store] from [2022-01-01] to [2025-12-31]. Here are the
first 10 rows: [paste rows].
Write a pandas script that loads the file, parses dates, sets a DatetimeIndex,
and reports: the inferred frequency, missing dates, duplicate dates, missing
values, and the 10 largest jumps between consecutive values. Do not fill or
drop anything yet. Starting with a quality check catches the problems that break everything later: gaps, duplicates and unit changes. Asking it not to fix anything yet keeps the decisions with you.
Prompt 2: Plot and Decompose the Series
Using the cleaned series, write code to plot it, then run an STL decomposition
with statsmodels using period=[7 for daily data with a weekly cycle]. Plot the
trend, seasonal and residual parts. Explain in two sentences what to look for
in each panel. STL (seasonal and trend decomposition using LOESS) splits a series into trend, seasonal and remainder parts. The statsmodels STL class is a standard choice in Python, and the model writes it reliably.
Prompt 3: Measure Trend and Seasonality
From the STL result, compute the strength of trend and strength of
seasonality as defined in Hyndman and Athanasopoulos, "Forecasting:
Principles and Practice". Show the formulas in comments and print both values. A plot can look seasonal when it is not. A number between 0 and 1 settles it, and asking for the formulas in comments lets you check the definition the model used.
Prompt 4: Test for Stationarity
Write code to run the ADF and KPSS tests on the series and on its first
difference. Then explain what each test's null hypothesis is and what the
combination of results means for choosing an ARIMA model. The two tests have opposite null hypotheses, which confuses many people. This is a good use of the model: it explains, and the code produces the numbers.
Prompt 5: Set Baselines Before Any Model
Before any forecasting model, write code for three baselines on the same
train/test split: naive (last value), seasonal naive (same period last cycle)
and the training mean. Hold out the last [24 months] as the test set. A baseline tells you whether a complex model is worth it. If a forecast cannot beat “same as last year”, it should not go into a report.
Prompt 6: Ask for Candidate Models With Reasons
Given these results [paste trend and seasonal strength, test results, series
length], suggest two or three forecasting models to try, such as ETS, ARIMA
or a regression with calendar features. For each, give the assumptions it
makes, why it fits this data, and the statsmodels code to fit it. Asking for assumptions and reasons turns a list of model names into something you can judge. Feeding it the measured results from the earlier prompts keeps the advice tied to your data.
Prompt 7: Write a Backtest Without Leakage
Write a backtest that compares the baselines and candidate models on the held-
out period using MAE and MASE. Make sure no information from the test period
is used in training, including in scaling, feature creation or model
selection. Print a table of results sorted by MAE. Leakage, where future information sneaks into training, is the most common reason a forecast looks great in testing and fails in use. Naming the usual places it hides makes the model far more likely to avoid them.
Prompt 8: Review Code for Mistakes
Review this forecasting code for bugs, data leakage, wrong date handling,
off-by-one errors in the train/test split, and metrics computed on the wrong
scale. List each issue with the line and a fix. Do not rewrite the whole
script. [paste code] A second reader for your code is one of the most valuable uses of a language model. Limiting it to a list of issues keeps the review focused and easy to verify.
Prompt 9: Explain the Results for a Decision-Maker
Here is the backtest table and the final forecast with 80% and 95%
prediction intervals [paste]. Write a five-sentence summary for a manager
deciding [how much stock to order]. Use only the numbers provided, state the
uncertainty plainly, and do not add numbers of your own. The instruction to use only the numbers provided matters. Without it, a model may round, combine or invent figures to make the summary read better. If the decision depends on a range rather than one number, our article on quantile loss explains how to evaluate those forecasts.
A Worked Example: What the Prompts Should Produce
The script below shows the kind of code prompts 1, 3, 5 and 7 should lead to, written and run for this article on the Mauna Loa CO2 dataset that ships with the statsmodels library: weekly carbon dioxide readings from March 1958 to December 2001. Use it as a reference to compare against what the model gives you. It uses statsmodels’ ExponentialSmoothing class for Holt-Winters.
import numpy as np
import pandas as pd
from statsmodels.datasets import co2
from statsmodels.tsa.holtwinters import ExponentialSmoothing
from statsmodels.tsa.seasonal import STL
# Weekly CO2 readings from Mauna Loa (ships with statsmodels), averaged to months.
weekly = co2.load_pandas().data["co2"]
print("missing weekly values:", weekly.isna().sum())
y = weekly.resample("MS").mean().interpolate()
print("months:", len(y), "from", y.index[0].date(), "to", y.index[-1].date())
# Seasonal-trend decomposition: how strong are trend and seasonality?
res = STL(y, period=12).fit()
var_resid = res.resid.var()
trend_strength = max(0, 1 - var_resid / (res.trend + res.resid).var())
seasonal_strength = max(0, 1 - var_resid / (res.seasonal + res.resid).var())
print(f"trend strength: {trend_strength:.2f}, seasonal strength: {seasonal_strength:.2f}")
# Backtest: hold out the last 24 months and compare two forecasts.
horizon = 24
train, test = y[:-horizon], y[-horizon:]
# Baseline: seasonal naive (repeat the last 12 months).
naive = np.tile(train[-12:].to_numpy(), horizon // 12)
# Model: Holt-Winters with additive trend and seasonality.
hw = ExponentialSmoothing(train, trend="add", seasonal="add", seasonal_periods=12).fit()
hw_forecast = hw.forecast(horizon).to_numpy()
def mae(pred):
return np.mean(np.abs(test.to_numpy() - pred))
print(f"MAE seasonal naive: {mae(naive):.2f} ppm")
print(f"MAE Holt-Winters: {mae(hw_forecast):.2f} ppm") Output (pandas 3.0 and statsmodels 0.15):
missing weekly values: 59
months: 526 from 1958-03-01 to 2001-12-01
trend strength: 1.00, seasonal strength: 0.99
MAE seasonal naive: 1.88 ppm
MAE Holt-Winters: 0.24 ppm Each line answers a question a pasted-numbers forecast would skip. There are 59 missing weekly readings, handled by averaging to months and interpolating. Trend and seasonality are both very strong. And Holt-Winters beats the seasonal naive baseline by a wide margin, because the baseline repeats last year’s level and misses the steady rise in CO2. On a series without a strong trend, that gap could shrink or reverse, which is exactly why prompt 5 comes before prompt 6.
Limits to Keep in Mind
- Pasted numbers are not analysis. If a reply contains statistics or forecasts, check that they came from code you can see.
- Context windows run out. Long series pasted as text can be cut off or summarized without warning. Upload a file or work with code instead.
- Code can be wrong in quiet ways. Generated code often runs without errors and still has a leaky split or a wrong frequency. That is why prompt 8 exists, and why you still read the code.
- Some jobs need specialized models. For many related series or complex patterns, look at dedicated forecasting libraries or time series foundation models rather than a chat model. Our guide to time series forecasting with VAEs covers one deep-learning option.
For more on structuring instructions so models follow them consistently, see our prompt engineering primer.
Back to the Sales Forecast
The analyst from the opening can still use ChatGPT for next quarter’s forecast, just not by asking for three numbers. The better path is a short conversation: check the data, measure its patterns, set a baseline, backtest two or three models, and ask for a plain summary built only from the results. The forecast then comes with an error measure and a range, and every number in it can be traced to code.
Frequently Asked Questions
Can ChatGPT Forecast Time Series Data?
Not on its own in a reliable way. A language model reading pasted numbers is not fitting a forecasting model. With its data analysis feature, ChatGPT can write and run Python that fits real models, and those results can be checked like any other code.
What Is the Best Prompt for Time Series Analysis in ChatGPT?
There is no single best prompt, but the most useful ones describe the data precisely (frequency, date range, what it measures), ask for code rather than answers, and state what the analysis is for. Prompt 1 above is a good starting point for any new series.
Should I Upload My Data to ChatGPT?
That depends on your organization’s data policies. If the data is sensitive, share only the column names and a few made-up sample rows, ask for code, and run the code on your own machine.
Which Python Libraries Should ChatGPT Use for Time Series?
pandas for loading and resampling, and statsmodels for decomposition, statistical tests, exponential smoothing and ARIMA cover most needs. Naming the library in your prompt keeps the generated code consistent and easier to check.




