You've probably seen those generic "10 prompts for data science" lists that suggest asking an AI to "analyze this dataset" and call it a day. But real data work is messy: your CSV has encoding issues, your features are skewed, your model overfits, and your stakeholder wants a plain-English explanation of a random forest. This guide isn't about generic prompts—it's a battle-tested collection of prompts I use daily to move from raw data to actionable insights and production-ready ML. Each prompt is designed to be copied, adapted, and combined with your own context. Whether you're a data analyst, a ML engineer, or a curious product manager, these prompts will save you hours and help you build more robust pipelines.
1. The Data Cleaning Autopsy
Prompt: "Act as a senior data engineer. I have a CSV file at data/raw_sales.csv with columns: order_id, customer_id, order_date, amount, product_category. The file has 50,000 rows. First, inspect the first 10 rows and compute summary statistics for all columns. Then, identify potential issues: missing values, duplicate rows, inconsistent date formats, outliers in amount, and category mismatches. For each issue, provide a code snippet in Python using pandas to fix it. Finally, write a cleaned version to data/clean_sales.csv and print the shape before and after."
Why it works: This prompt forces the AI to perform an exploratory data analysis (EDA) before cleaning, mimicking a real workflow. By asking for specific code and output, you get a reproducible script.
Example output snippet:
import pandas as pd
# Load data
sales = pd.read_csv('data/raw_sales.csv')
print(sales.head())
# Check missing values
print(sales.isnull().sum())
# Drop duplicates
sales = sales.drop_duplicates()
# Convert dates
sales['order_date'] = pd.to_datetime(sales['order_date'], errors='coerce')
2. The Feature Engineering Brainstorm
Prompt: "I'm building a model to predict customer churn. My dataset has features: tenure_months, monthly_charges, total_charges, contract_type, payment_method, num_support_tickets. Suggest 5 new features that could improve predictive performance, with justification based on common churn patterns. For each feature, provide Python code to create it from the existing columns. Rank them by expected business impact."
Why it works: This prompt taps into domain knowledge and forces the AI to think about feature importance, not just coding. It also gives you a ranked list, helping you prioritize.
Example features: avg_charges_per_month, interaction_tenure_contract, support_ticket_ratio, high_usage_ratio, payment_consistency_score.
3. The EDA Storyteller
Prompt: "Act as a data scientist doing exploratory data analysis. Use the pandas_profiling library (or ydata-profiling) to generate a profile report for the dataset df (loaded from data/clean_sales.csv). Then, write a markdown summary of the top 5 insights from the report, including specific numbers (e.g., '30% of orders are from category X'). Finally, create two visualizations using matplotlib or seaborn that illustrate the most interesting findings, and save them as PNG files."
Why it works: This prompt combines automated profiling with human-readable insights and visual output. It's perfect for quickly understanding a new dataset.
Example code:
from ydata_profiling import ProfileReport
profile = ProfileReport(df, title='Sales Profiling Report')
profile.to_file('reports/sales_profile.html')
4. The Visualization Translator
Prompt: "I have a time series of daily sales for the last year. Create a line chart using plotly that shows sales over time, with a moving average trendline (7-day and 30-day). Add annotations for the highest and lowest sales days. Style it with a clean, professional look (light background, no gridlines). Provide the full Python code and the resulting interactive HTML output."
Why it works: This prompt specifies the library, the chart type, the desired features (trendlines, annotations), and the output format—no ambiguity.
5. The Baseline Model Builder
Prompt: "I'm working on a binary classification problem: predicting whether a customer will buy again. I'll use scikit-learn. Start by splitting the data into train/test (80/20, stratified). Then, build a baseline model using logistic regression with default parameters. Evaluate it using accuracy, precision, recall, F1-score, and ROC-AUC. Print a classification report and confusion matrix. Then, suggest two more complex models (e.g., random forest, XGBoost) that might perform better, and explain why."
Why it works: A baseline is crucial, and this prompt sets up the entire evaluation framework. It's a template you can reuse for any classification problem.
6. The Hyperparameter Tuning Pro
Prompt: "I have a random forest classifier for predicting customer churn. The current parameters are n_estimators=100, max_depth=5. Use GridSearchCV with 5-fold cross-validation to find the best hyperparameters from a grid: n_estimators in [50, 100, 200], max_depth in [3, 5, 7, None], min_samples_split in [2, 5, 10]. Report the best parameters and the cross-validation score. Also, plot feature importance from the best model."
Why it works: This prompt is specific about the grid and the evaluation method, preventing the AI from going off-track. It also asks for a visualization, which is great for interpretability.
7. The Overfit Detective
Prompt: "My model achieves 99% accuracy on training data but only 70% on test data. I suspect overfitting. Analyze the learning curves (plot training and validation scores vs. training set size) and suggest regularization techniques. Provide code to generate learning curves using sklearn.model_selection.learning_curve. Then, recommend specific changes to the model (e.g., increase regularization, reduce model complexity, add dropout if using neural nets) and show how to implement them in scikit-learn."
Why it works: Overfitting is a common issue, and this prompt guides the AI to diagnose and fix it systematically.
8. The Model Interpreter
Prompt: "I've trained a gradient boosting model (XGBoost) to predict house prices. Use SHAP to explain the model's predictions. Generate a summary plot (beeswarm) and a bar plot of mean absolute SHAP values. Then, pick one specific prediction (e.g., the 10th row in the test set) and explain why the model made that prediction in plain English, referencing the SHAP values."
Why it works: Explainability is critical for stakeholder trust. This prompt gives you both global and local interpretability.
9. The Deployment Ready Script
Prompt: "I need to deploy my trained model as a REST API using FastAPI. The model is a scikit-learn pipeline that includes preprocessing and a RandomForestClassifier. Write a complete app.py that loads the model from model.pkl, defines a POST /predict endpoint that accepts JSON with feature values, and returns the prediction and probability. Include input validation using Pydantic. Also, write a requirements.txt file with the necessary dependencies."
Why it works: This prompt covers the entire deployment path, from loading the model to input validation, and gives you a production-ready script.
10. The Data Storyteller
Prompt: "I've just finished a project analyzing customer feedback for a SaaS product. The main findings are: 1) 75% of negative feedback mentions 'slow loading times', 2) users on the free plan churn 2x more than paid, 3) a new feature 'dark mode' increased engagement by 15%. Write a 3-paragraph summary for a non-technical executive. Include a clear narrative, key numbers, and a recommendation for the next quarter. Avoid jargon."
Why it works: Communication is a huge part of data science. This prompt forces the AI to translate technical results into business impact.
11. The SQL to DataFrame Translator
Prompt: "I have the following SQL query that joins two tables orders and customers. Convert it to an equivalent pandas operation in Python. The query is: SELECT c.country, SUM(o.amount) as total_sales FROM orders o JOIN customers c ON o.customer_id = c.id GROUP BY c.country HAVING total_sales > 10000 ORDER BY total_sales DESC;. Provide the pandas code and the resulting DataFrame."
Why it works: Many data scientists come from SQL backgrounds, and this prompt bridges the gap, giving you a reusable pattern.
12. The Reproducibility Guardian
Prompt: "I want to make my data science project reproducible. I'm using Python and Jupyter notebooks. Create a Makefile that includes targets: data (downloads raw data), clean (runs cleaning script), features (runs feature engineering), train (trains model), evaluate (evaluates model), and report (generates a markdown report). For each target, specify the command and the output files. Also, suggest how to use pip freeze or conda env export for dependency management."
Why it works: Reproducibility is key in professional data science. This prompt gives you a concrete setup for a project pipeline.
Putting It All Together
These prompts aren't magic—they're structured ways to communicate with AI that mimic the thought process of a seasoned data scientist. The key is to be specific about your data, your goals, and the output you expect. Start with the data cleaning prompt, move through EDA and feature engineering, then model building and interpretation, and finally deployment. Each prompt can be adapted to your own dataset and problem. The more context you provide, the better the AI's response. And remember: always validate the output, especially when it involves data—AI can hallucinate, but with clear prompts, you'll catch it early.
Now, open your Jupyter notebook, copy the first prompt, and watch your data pipeline become smoother. If you want to go deeper, check out the official documentation of pandas, scikit-learn, and SHAP to understand the underlying methods. Happy modeling!
Comments