AdvancedavancadoFree prompt

Predictive Analysis with Python: Regression and Demand Forecasting

Builds a demand forecasting model using scikit-learn and Prophet, with cross-validation and API deployment for daily business use.

Create a complete Python predictive analytics pipeline — from data preparation to generating forecasts consumable by the operations team — using linear regression, decision trees, and Facebook Prophet for time series analysis.

At a glance

Access

Free prompt

Open to copy without upgrading.

Prompt objective

Create a complete Python predictive analytics pipeline — from data preparation to generating forecasts consumable by the operations team — using linear regression, decision trees, and Facebook Prophet for time series analysis.

Real use case

A regional distributor with 280 SKUs and 3 distribution centers loses $380K annually in perishable waste and $210K in stockouts due to lacking demand forecasts. The procurement team decides weekly orders by looking at the previous week, without considering seasonality or promotions.

Customize these fields first

COMPANY NAMENUMBERPERIOD'date''year''month''week''day_of_week'

Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.

Prompt

Create a complete demand forecasting pipeline in Python for [COMPANY NAME], with [NUMBER] SKUs and [PERIOD] months of sales history.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Environment Setup:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`bash\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\npip install pandas numpy scikit-learn prophet matplotlib seaborn joblib fastapi uvicorn\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Part 1 — Data Preparation:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`python\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nimport pandas as pd\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nimport numpy as np\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfrom sklearn.preprocessing import LabelEncoder\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Load sales data\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf = pd.read_csv('sales.csv', parse_dates=['date'])\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Feature engineering for time series\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['year'] = df['date'].dt.year\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['month'] = df['date'].dt.month\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['week'] = df['date'].dt.isocalendar().week\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['day_of_week'] = df['date'].dt.dayofweek\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['quarter'] = df['date'].dt.quarter\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Lag variables (demand from previous periods)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['demand_lag_1'] = df.groupby('sku')['demand'].shift(1)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['demand_lag_4'] = df.groupby('sku')['demand'].shift(4)  # 4 weeks ago\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['rolling_avg_4'] = df.groupby('sku')['demand'].transform(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    lambda x: x.shift(1).rolling(4).mean()\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Holiday indicators (adjust for your market)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nholidays = ['2025-01-01', '2025-04-18', '2025-09-07', '2025-12-25']\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['is_holiday'] = df['date'].dt.date.astype(str).isin(holidays).astype(int)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Encode categorical variables\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nle = LabelEncoder()\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['sku_encoded'] = le.fit_transform(df['sku'])\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndf['category_encoded'] = le.fit_transform(df['category'])\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Part 2 — Regression Model (scikit-learn):**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`python\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfrom sklearn.ensemble import GradientBoostingRegressor\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfrom sklearn.model_selection import TimeSeriesSplit\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfrom sklearn.metrics import mean_absolute_percentage_error, mean_squared_error\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Features and target\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfeatures = ['sku_encoded', 'month', 'week', 'day_of_week', 'quarter',\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n            'demand_lag_1', 'demand_lag_4', 'rolling_avg_4', 'is_holiday',\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n            'unit_price', 'discount_pct']\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nX = df[features].dropna()\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ny = df.loc[X.index, 'demand']\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Cross-validation respecting temporal order\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ntscv = TimeSeriesSplit(n_splits=5)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nerrors = []\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfor train_idx, val_idx in tscv.split(X):\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    X_train, X_val = X.iloc[train_idx], X.iloc[val_idx]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    y_train, y_val = y.iloc[train_idx], y.iloc[val_idx]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    model = GradientBoostingRegressor(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n        n_estimators=300, max_depth=5, learning_rate=0.05, random_state=42\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    )\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    model.fit(X_train, y_train)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    predictions = model.predict(X_val)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    errors.append(mean_absolute_percentage_error(y_val, predictions))\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nprint(f'Average MAPE: {np.mean(errors):.2%}')  # Target: < 15% for perishables\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Train final model with all data\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfinal_model = GradientBoostingRegressor(...).fit(X, y)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n# Feature importance for explainability\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nimportance = pd.Series(final_model.feature_importances_, index=features)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nprint(importance.sort_values(ascending=False))\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Part 3 — Facebook Prophet for High-Volume SKUs:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`python\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nfrom prophet import Prophet\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ndef forecast_with_prophet(df_sku, periods=8):\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Open directly in an AI — the text is pre-filled:

How to use this prompt

  1. 1Replace the key placeholders first: COMPANY NAME, NUMBER, PERIOD, 'date'.
  2. 2Replace any bracketed placeholders like [this] with your own context.
  3. 3Add extra background information when you want more tailored results.
  4. 4Combine multiple prompts in one conversation when you need a richer output.
  5. 5Save your best-performing prompts so they are easy to reuse later.

Next best step

Open the guide first, then branch only if you still need more.

A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.

If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.

Related prompts

View all

Advanced Financial Analysis DAX Formulas in Power BI

Creates complex DAX measures for time intelligence calculations, cost allocation, and profitability analysis by segment in Power BI.

AdvancedFree prompt

Best for

Develop a production-ready set of DAX measures that solve the most common financial BI calculations: YoY, YTD, PMPM, margin calculation by segment, indirect expense allocation, and linear forecasting in Power BI Desktop.

Copy-ready promptOpen prompt

Multichannel Marketing Data Correlation with Revenue Attribution

Correlation analysis between marketing channels (Google, Meta, email, organic) and revenue, with a multi-touch attribution model for budget optimization.

AdvancedFree prompt

Best for

Identify which marketing channels have the highest correlation with conversions and revenue, build a multi-touch attribution model, and distribute media budget based on actual performance data—replacing last-click attribution.

Copy-ready promptOpen prompt

Complete Cohort Analysis: Retention, Revenue, and Product Behavior

Cohort analysis framework for digital products covering user retention, revenue per cohort, feature adoption, and high-value user profile identification.

AdvancedFree prompt

Best for

Implement cohort analysis across three dimensions—usage retention, cumulative revenue, and feature adoption—to identify which customer cohorts are most valuable, what differentiates users who stay from those who churn, and where to focus product and marketing efforts.

Copy-ready promptOpen prompt

LTV Calculation for SaaS: Models, Segmentation, and Growth Impact

Complete framework for calculating SaaS Lifetime Value with segmented churn by plan, inflation correction, and strategic use of LTV for CAC decisions, pricing, and product cohorts.

AdvancedFree prompt

Best for

Develop a robust LTV model accounting for real market conditions—interest rates, inflation, segmented churn, and currency effects—enabling the growth team to make acquisition budget, pricing, and product decisions based on actual customer value per cohort.

Copy-ready promptOpen prompt

Explore other prompt categories

Move sideways into adjacent libraries when the current category is not the full answer.

Free browsing stays open. Premium prompts unlock the reusable workflow layer.

Use the guides and role paths to validate the job first. Upgrade when you want the full prompt text, editable premium prompts, and the surrounding course paths in one place.

Free access

  • Browse guides, role paths, and category pages.
  • Preview prompts before you decide to upgrade.
  • Find the right starting point without friction.

Membership access

  • Unlock premium prompts and the full copy text.
  • See more workflow paths and course connections.
  • Keep the reusable templates in one place.
Chat on WhatsApp