From 3 Days to 2 Hours: How Data Science Prompts Transformed Our Analytics Workflow

We all know the pain: you spend days cleaning data, writing boilerplate code, and tuning visualizations, only to realize the business question has changed. In our team, the turning point came when we adopted a prompt-based approach to data analysis. Instead of writing every line of code from scratch, we started using carefully crafted prompts to guide AI assistants—and our turnaround time for standard analytical requests dropped from three days to just two hours. This isn't magic; it's about structuring your requests to leverage AI where it excels: code generation, pattern recognition, and iterative refinement. Below, we share the exact prompt templates that transformed our workflow, organized by complexity. Whether you're a data analyst or a machine learning engineer, these prompts will help you automate the boring parts and focus on the insights.

Basic Prompts: For Quick Wins and Repetitive Tasks

These prompts are your starting point. They're designed to be simple, direct, and effective for common data tasks that don't require deep domain knowledge.

1. The Data Cleaning Prompt

Task: Automate the initial exploration and cleaning of a dataset.

Prompt:

Act as a senior data analyst. I have a CSV file at 'data.csv' with columns: [list columns]. Perform the following steps:
1. Load the data using pandas.
2. Display the first 5 rows and the data types.
3. Check for missing values and duplicate rows.
4. For each column, suggest a strategy for handling missing values (e.g., drop, fill with median, forward fill) based on the data type and distribution.
5. Implement the cleaning steps in a function called 'clean_data' that returns the cleaned DataFrame.
6. Show a summary of the cleaned data (rows, columns, missing values).

Example Result:
The AI generates a Python script that loads the data, prints the first rows, identifies missing values, and creates a clean_data function with appropriate imputation logic. This alone saved us hours of manual data profiling.

2. The Exploratory Data Analysis (EDA) Prompt

Task: Generate a comprehensive EDA report with visualizations.

Prompt:

Act as a data scientist. Using the cleaned DataFrame from the previous step, perform an exploratory data analysis:
1. Generate descriptive statistics for all numeric columns.
2. Create histograms for all numeric columns and boxplots for the top 5 by skewness.
3. For categorical columns, show frequency counts and bar charts.
4. Compute the correlation matrix and visualize it as a heatmap.
5. Identify any outliers using the IQR method and list them.
6. Summarize key findings in bullet points.

Example Result:
The AI outputs a Python script using matplotlib and seaborn, producing a set of charts and a textual summary. We can then review the visualizations and decide on next steps in minutes.

3. The Feature Engineering Prompt

Task: Automatically suggest and create new features from existing data.

Prompt:

Act as a feature engineering expert. Given the cleaned DataFrame with columns [list], propose 5 new features that could improve predictive model performance. For each feature, explain the rationale and provide Python code to create it. Focus on:
- Interactions between numeric variables
- Date/time-based features (if applicable)
- Aggregations of categorical variables
- Domain-specific transformations (e.g., log, square root)

Example Result:
The AI suggests features like age_bins, total_amount_per_category, or day_of_week, complete with code snippets. This accelerates our feature store development.

4. The Visualization Prompt

Task: Create a specific chart tailored to an audience.

Prompt:

Act as a data visualization expert. Create a Python script using matplotlib or seaborn to generate a [chart type] that shows [relationship]. The chart should be:
- Colorblind-friendly
- Have a title and axis labels
- Use a clean style (e.g., 'ggplot' or 'seaborn')
- Save the figure as a PNG at 150 dpi
Data: [describe data or load from file]

Example Result:
A ready-to-run script that produces a publication-quality chart, saving us time on tweaking aesthetics.

5. The SQL Query Prompt

Task: Translate a business question into a SQL query.

Prompt:

Act as a SQL expert. Write a SQL query to answer: [business question]. Use the schema: [provide table definitions]. Ensure the query is optimized for performance (use appropriate joins, indexes, and aggregations). Also, explain the logic behind your query.

Example Result:
A well-structured SQL query with comments and an explanation, reducing the back-and-forth with our database team.

Advanced Prompts: For Model Building and Validation

These prompts assume you have a basic pipeline and want to integrate AI for modeling tasks.

6. The Model Selection Prompt

Task: Choose the best machine learning model for a given problem.

Prompt:

Act as a machine learning consultant. I have a dataset with [features] and a target variable [target]. The task is [classification/regression]. Compare the following models: Logistic Regression, Random Forest, XGBoost, and a simple Neural Network. For each:
1. Train with default hyperparameters using cross-validation (5-fold).
2. Report the appropriate metric (accuracy, F1, RMSE, etc.).
3. Provide a recommendation based on performance and interpretability.
4. Write Python code using scikit-learn and xgboost to reproduce the results.

Example Result:
A comparison table and a recommendation, plus reusable code for model training and evaluation.

7. The Hyperparameter Tuning Prompt

Task: Automate hyperparameter tuning for a chosen model.

Prompt:

Act as an ML engineer. For the [model] with hyperparameters [list], use Bayesian optimization (or grid search) to find the optimal parameters. The search space should be [define ranges]. Use 5-fold cross-validation and the metric [metric]. Provide the final best parameters and the corresponding performance. Write code using scikit-learn's GridSearchCV or Optuna.

Example Result:
A script that runs the tuning and outputs the best parameters, saving manual experimentation time.

8. The Feature Importance Prompt

Task: Interpret a model by analyzing feature importance.

Prompt:

Act as a data scientist. I have trained a [model] on my dataset. Compute feature importance using:
- For tree-based models: feature_importances_ attribute
- For linear models: coefficients
- For any model: SHAP values
Visualize the top 20 features in a bar chart. Provide a brief interpretation of the results.

Example Result:
A chart and a summary, helping us communicate results to stakeholders.

9. The Model Evaluation Prompt

Task: Generate a comprehensive evaluation report for a model.

Prompt:

Act as a data scientist. Evaluate the trained model on a test set. Produce:
- Confusion matrix (for classification) or residual plot (for regression)
- Precision, recall, F1-score (classification) or MAE, RMSE (regression)
- ROC curve and AUC (if binary classification)
- Calibration plot
- A short written summary of the model's strengths and weaknesses.

Example Result:
A set of visualizations and a textual assessment, ready for inclusion in a report.

10. The Overfitting Detection Prompt

Task: Check for overfitting and suggest remedies.

Prompt:

Act as an ML expert. My model achieves [train accuracy] on training data and [test accuracy] on test data. Is this overfitting? If so, suggest at least three strategies to mitigate it (e.g., regularization, early stopping, dropout). Write Python code to implement one of these strategies and compare results.

Example Result:
An analysis of the gap and concrete code for regularization, helping us generalize better.

Expert Prompts: For Complex Workflows and Production

These prompts are for experienced practitioners who need to integrate AI into their entire pipeline.

11. The End-to-End Pipeline Prompt

Task: Generate a complete machine learning pipeline from data ingestion to deployment.

Prompt:

Act as a lead ML engineer. Design a production-ready pipeline for the following task: [describe task]. The pipeline should include:
- Data ingestion from [source]
- Data validation (using Great Expectations or similar)
- Feature engineering
- Model training with tracking (e.g., MLflow)
- Model evaluation and registration
- Inference endpoint (e.g., FastAPI)
Provide the folder structure, Dockerfile, and Python scripts for each component. Use best practices like type hints, logging, and error handling.

Example Result:
A scaffolded project with all files, ready to be adapted. This is our go-to for starting new projects.

12. The Automated Retraining Prompt

Task: Set up a system that retrains models automatically on a schedule.

Prompt:

Act as a DevOps ML engineer. Create a Python script that checks for new data in [location], retrains the model if the data has changed significantly (e.g., using drift detection), and updates the model registry. Use cron or Airflow DAG to run daily. Include logging and alerting in case of failure.

Example Result:
A script with scheduling configuration, ensuring our models stay fresh.

13. The A/B Testing Prompt

Task: Design and analyze an A/B test for a new model.

Prompt:

Act as a data scientist. I have run an A/B test where the control is the old model and the treatment is the new model. The data is in [file] with columns [list]. Perform a hypothesis test to determine if the new model significantly improves the primary metric [metric]. Use a t-test or Mann-Whitney U test, and also calculate the lift and confidence intervals. Provide a summary and recommendation.

Example Result:
A statistical analysis with a clear conclusion, saving us from manual calculations.

14. The Model Interpretability Prompt

Task: Generate SHAP explanations for a complex model.

Prompt:

Act as an explainable AI expert. Using the SHAP library, create a detailed explanation for my [model] on a sample of [size]. Include:
- A summary plot
- A dependence plot for the top 3 features
- A force plot for 2 individual predictions
- A textual interpretation of the global feature importance

Example Result:
A comprehensive explanation, useful for regulatory compliance and stakeholder trust.

15. The Data Drift Detection Prompt

Task: Monitor data drift in production.

Prompt:

Act as an ML engineer. Implement a data drift detection system using the Evidently library. Compare the current data distribution to the training data, and produce a report with drift metrics (e.g., PSI, KS-test). Set up a threshold for alerting. Write a Python script that runs this check daily and logs the results.

Example Result:
A script with Evidently, giving us early warnings about data distribution shifts.

16. The Time Series Forecasting Prompt

Task: Build a robust time series forecast.

Prompt:

Act as a time series expert. I have a time series dataset at [frequency] with [seasonality]. Build a forecast using Prophet or ARIMA. Include:
- Stationarity check (ADF test)
- Differencing if needed
- Model fitting
- Forecast for the next [periods] with confidence intervals
- Visualize the results
- Evaluate with MAE and RMSE

Example Result:
A forecast with metrics and a plot, speeding up our demand planning.

17. The Natural Language Query Prompt

Task: Use AI to answer business questions from data using natural language.

Prompt:

Act as a data analyst. Write a Python script using the pandasai library that allows a user to ask questions about a dataset in natural language and get answers (e.g., "What is the total sales by region?"). Include a fallback for ambiguous questions.

Example Result:
A prototype of a conversational analytics tool, which we later integrated into our internal dashboard.

18. The Data Storytelling Prompt

Task: Transform analysis results into a compelling narrative.

Prompt:

Act as a data storyteller. Based on the following analysis results [paste results], write a concise report for a non-technical audience. Structure it as: Executive Summary, Key Findings, and Recommendations. Use plain language, avoid jargon, and include a relevant chart description.

Example Result:
A polished report that we can send directly to management, saving us writing time.

From Prompts to Production: Lessons Learned

In our experience, the key to success is not just the prompts themselves, but how you integrate them into your workflow. For instance, we started by using the basic prompts to automate repetitive tasks, then gradually moved to advanced ones for model tuning, and finally to expert prompts for end-to-end pipelines. The result: a dramatic reduction in time from concept to insight. But remember, prompts are not a silver bullet—they require human oversight and domain knowledge. We always review the AI-generated code and results, and we continuously refine our prompts based on what works. As you adopt these prompts, you'll likely develop your own variations and discover new use cases. The future of data analysis is human-AI collaboration, and these prompts are your first step.

Ready to cut your analysis time? Start with the basic prompts today and see the difference.

← All posts

Comments