AI Prompts for ChatGPT for Data Science

20 of the best prompts for ChatGPT for data science, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

AI Prompts for ChatGPT for Data Science

20 of the best prompts for ChatGPT for data science, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

Scroll to explore

Published July 4, 2026

Accelerate your data science workflow from EDA to model deployment using ChatGPT prompts for exploratory analysis, feature engineering, model selection, and communicating results. This guide walks you through every stage of ChatGPT for Data Science, from Foundation: Exploratory Data Analysis all the way through Communication: Presenting Results to Stakeholders, with a curated, copy-ready prompt at each step. Each stage targets a specific phase of the process so you always know exactly what to ask and what output to expect. Works with ChatGPT, Claude, and Gemini and any other major AI tool.

Foundation: Exploratory Data Analysis

EDA is where you learn what your data is actually telling you before any modeling begins. These prompts structure the initial investigation and surface the issues that determine your analytical approach.

EDA Starting Script

Write a Python EDA script for a dataset with these columns and types: [PASTE DF.DTYPES OUTPUT OR DESCRIBE COLUMNS]. The script should systematically: (1) check shape, data types, and memory usage, (2) identify missing values with percentages per column, (3) compute descriptive statistics separating numeric and categorical features, (4) identify potential duplicate rows, (5) check cardinality of categorical columns, (6) detect obvious data quality issues (negative values where impossible, dates out of range, impossible category combinations), (7) generate a profile report summary. Use pandas and print clear section headers. Do not plot yet.

Foundation: Exploratory Data Analysis

Visualization Suite

Write a Python visualization suite for this dataset: [DESCRIBE DATASET: WHAT IT IS, KEY COLUMNS, WHAT I AM TRYING TO UNDERSTAND]. Use matplotlib and seaborn. Include: (1) distribution plots for all numeric features (histograms + KDE), (2) count plots for all categorical features, (3) a correlation heatmap, (4) box plots showing the target variable distribution across key categorical features, (5) a pairplot for the 5 most correlated features, (6) time series plot if there is a date column. Use a consistent style and add titles and axis labels to every plot. Arrange all plots in a logical narrative order.

Foundation: Exploratory Data Analysis

Missing Data Analysis

I have a dataset with missing values. Here is the missing value summary: [PASTE DF.ISNULL().SUM() OUTPUT]. The target variable is: [DESCRIBE]. For each column with missing data, analyze: (1) is the missing data MCAR, MAR, or MNAR (and why), (2) what imputation strategy is appropriate (mean/median/mode, KNN imputation, model-based, forward fill, indicator variable), (3) the risk of each strategy for downstream modeling. Then write the pandas/sklearn code to implement the recommended imputation strategy. Use ColumnTransformer to keep training and test imputation separate.

Foundation: Exploratory Data Analysis

Outlier Detection

Write Python code to detect and investigate outliers in this dataset. Columns of interest: [LIST NUMERIC COLUMNS]. Implement: (1) IQR method with customizable fence multiplier, (2) Z-score method, (3) isolation forest for multivariate outliers, (4) visualizations showing outliers in context (box plots, scatter plots). For each outlier detected, output the row data so I can inspect it. Then ask me to decide: remove, cap (winsorize), or flag with an indicator variable. Include a function that applies my chosen strategy and documents how many rows were affected.

Foundation: Exploratory Data Analysis

Feature Relationship Analysis

Analyze the relationship between features and the target variable in my dataset. Target: [DESCRIBE TARGET VARIABLE, CLASSIFICATION OR REGRESSION]. Features: [LIST KEY FEATURES]. Write code to: (1) compute correlation (Pearson + Spearman) with the target for numeric features, (2) compute Cramér's V or chi-square for categorical features vs. target, (3) compute point-biserial correlation if target is binary, (4) plot the top 10 most correlated features sorted by absolute correlation, (5) flag any features with near-zero correlation that are candidates for removal, (6) identify any features correlated with each other above 0.85 (collinearity risk).

Foundation: Exploratory Data Analysis

Feature Engineering and Preprocessing

Feature engineering is where domain knowledge transforms raw data into signals a model can use. Good features outperform sophisticated models on poor features every time.

Feature Engineering Pipeline

Write a scikit-learn preprocessing pipeline for a dataset with these characteristics: [DESCRIBE: WHICH COLUMNS ARE NUMERIC, WHICH ARE CATEGORICAL, WHICH NEED SPECIAL TREATMENT, WHAT THE TARGET IS]. The pipeline should use ColumnTransformer and Pipeline to: (1) impute missing values appropriately for each column type, (2) scale numeric features (StandardScaler or RobustScaler if outliers present), (3) encode categorical features (OrdinalEncoder vs OneHotEncoder vs TargetEncoder based on cardinality), (4) create any interaction or polynomial features, (5) handle any datetime columns by extracting meaningful components. Make the pipeline serializable with joblib.

Feature Engineering and Preprocessing

Datetime Feature Extraction

Write Python code to extract useful features from these datetime columns in my dataset: [LIST DATETIME COLUMNS AND DESCRIBE WHAT THEY REPRESENT]. For each datetime column, extract: (1) year, month, day, hour, day of week, week of year where meaningful, (2) cyclical encoding of periodic features (sin/cos transformation for hour, month, day of week), (3) time since a reference date, (4) is_weekend, is_holiday (using a holiday calendar), (5) lag features if this is time series data [DESCRIBE TIME SERIES STRUCTURE IF APPLICABLE], (6) rolling window statistics if applicable. Explain which features are most likely to be predictive for my use case.

Feature Engineering and Preprocessing

Target Encoding

Implement target encoding for these high-cardinality categorical columns: [LIST COLUMNS WITH CARDINALITIES]. The target is [DESCRIBE: BINARY/MULTICLASS/CONTINUOUS]. Implement: (1) leave-one-out target encoding to prevent data leakage, (2) smoothing with prior to handle low-count categories, (3) cross-validation-safe implementation that fits on training folds and transforms test folds, (4) handling of unseen categories at inference time, (5) integration into a scikit-learn Pipeline. Explain the data leakage risk of naive target encoding and how this implementation prevents it.

Feature Engineering and Preprocessing

Feature Selection Strategy

Write Python code to select the most important features from a dataset with [X] features for a [CLASSIFICATION/REGRESSION] problem. Implement: (1) filter methods (correlation, chi-square, mutual information), (2) wrapper method (recursive feature elimination with cross-validation), (3) embedded method (feature importance from a tree model), (4) a consensus voting approach that combines all three methods, (5) a plot showing feature importance from each method. Return the final recommended feature set and explain how to validate that this selection does not hurt model performance.

Feature Engineering and Preprocessing

Class Imbalance Handling

My classification dataset is imbalanced: [DESCRIBE CLASS DISTRIBUTION, E.G., 95% NEGATIVE, 5% POSITIVE]. The task is to predict [DESCRIBE]. Implement and compare these approaches for handling imbalance: (1) class_weight parameter in the model, (2) SMOTE oversampling with imbalanced-learn, (3) undersampling the majority class, (4) threshold tuning on probabilities after training. For each approach: show the implementation, explain the trade-offs, and show how to evaluate performance using the right metrics (precision-recall curve, F1, ROC-AUC) rather than accuracy. Recommend the best approach for my specific use case.

Feature Engineering and Preprocessing

Modeling: Selection, Training, and Evaluation

Model selection is not about using the most sophisticated algorithm. It is about matching the model class to the problem structure, data size, and interpretability requirements.

Model Selection Framework

Help me choose the right model for this problem: Data: [DESCRIBE SHAPE, FEATURE TYPES, MISSING DATA SITUATION]. Target: [CLASSIFICATION/REGRESSION, CLASS DISTRIBUTION]. Constraints: [DESCRIBE: NEED INTERPRETABILITY, INFERENCE LATENCY REQUIREMENT, TRAINING TIME BUDGET, DEPLOYABILITY]. Generate a model selection recommendation covering: (1) which model families are appropriate and why, (2) which to try first and in what order, (3) the baseline model I must beat to justify ML complexity, (4) what metric to optimize (and why not accuracy if classification), (5) any models that are inappropriate for this problem and why.

Modeling: Selection, Training, and Evaluation

Cross-Validation Setup

Write a proper cross-validation setup for this problem: [DESCRIBE: DATASET SIZE, WHETHER DATA IS I.I.D. OR TIME SERIES, ANY GROUP STRUCTURE LIKE MULTIPLE ROWS PER USER, TARGET CLASS BALANCE]. Choose between KFold, StratifiedKFold, GroupKFold, TimeSeriesSplit, or a custom splitter. Implement: (1) the correct CV splitter for my data structure, (2) a cross_val_score or cross_validate call with appropriate scoring metrics, (3) handling of the preprocessing pipeline inside the cross-validation (not outside, which would cause data leakage), (4) a results table with mean and std for each metric, (5) a brief explanation of why this CV strategy is correct for my data.

Modeling: Selection, Training, and Evaluation

Hyperparameter Tuning

Write hyperparameter tuning code for a [DESCRIBE MODEL: XGBOOST/LIGHTGBM/RANDOM FOREST/NEURAL NETWORK] for [DESCRIBE PROBLEM]. Implement: (1) an Optuna study with a logical search space for each hyperparameter, (2) pruning via MedianPruner for early stopping of bad trials, (3) the objective function with proper cross-validation inside, (4) visualization of the optimization history and parameter importances, (5) extraction of the best parameters and retraining on the full training set, (6) comparison of default vs. tuned model performance. Explain which hyperparameters matter most for this model family.

Modeling: Selection, Training, and Evaluation

Model Evaluation Deep Dive

Write a comprehensive model evaluation for a [BINARY CLASSIFICATION/MULTICLASS/REGRESSION] model. Implement: (1) the appropriate metrics (for classification: confusion matrix, precision, recall, F1, ROC-AUC, PR-AUC; for regression: RMSE, MAE, R², MAPE), (2) calibration plot if the model outputs probabilities, (3) learning curves (training and validation score vs. training size) to diagnose bias/variance, (4) feature importance plot, (5) error analysis on the worst predictions (cases where the model was most wrong), (6) if classification: threshold analysis to find the optimal classification threshold for my business objective.

Modeling: Selection, Training, and Evaluation

Model Interpretation

Write Python code to interpret and explain predictions from a trained [MODEL TYPE] for [DESCRIBE PROBLEM]. Use SHAP: (1) compute SHAP values for the entire test set, (2) global feature importance (SHAP summary plot), (3) feature interaction effects (SHAP dependence plot for the top 3 features), (4) local explanation for 3 specific predictions: one true positive, one false positive, one false negative, with waterfall plots, (5) a plain-English summary of the 3 most important factors the model uses and what direction they push predictions. Also compare SHAP values to the model's native feature importance.

Modeling: Selection, Training, and Evaluation

Communication: Presenting Results to Stakeholders

The best model in the world creates no value if stakeholders do not understand or trust it. These prompts help you translate technical results into decisions.

Model Performance Summary for Non-Technical Audience

Help me write a summary of my model's performance for a non-technical stakeholder audience. My model does: [DESCRIBE WHAT IT PREDICTS]. Performance: [PASTE KEY METRICS]. Business context: [DESCRIBE HOW THE MODEL WILL BE USED AND WHAT DECISIONS IT WILL SUPPORT]. Write: (1) a one-paragraph plain-English summary of what the model does, (2) an explanation of the key metrics in business terms (not "precision" but "of the customers we flag as high-risk, X% actually are"), (3) what the model gets wrong and the likely business impact, (4) a comparison to the current process the model replaces. Avoid all ML jargon.

Communication: Presenting Results to Stakeholders

Experiment Results Table

Format these model experiment results into a clean comparison table for a team meeting or report: [PASTE RESULTS FROM MULTIPLE MODEL RUNS OR CONFIGURATIONS]. Include: model name/config, key metrics, training time, inference time if relevant. Highlight the best model in each metric. Write a 200-word "Experiment Conclusions" section below the table covering: which model won and why, what we tried that did not help, the one surprising finding, and the recommended next steps. Keep technical jargon to a minimum for a mixed audience.

Communication: Presenting Results to Stakeholders

A/B Test Results Interpretation

Interpret the results of an A/B test for my ML model: [DESCRIBE THE TEST SETUP, WHAT WAS THE CONTROL VS. TREATMENT, WHAT METRICS WERE MEASURED, AND PASTE THE RESULTS]. Help me: (1) confirm statistical significance was properly established (sample size, p-value, confidence intervals), (2) identify any practical significance vs. statistical significance gap, (3) check for any novelty effects or external confounds that could explain the results, (4) calculate the estimated business impact at full rollout, and (5) write a 250-word recommendation memo for the decision to roll out or not.

Communication: Presenting Results to Stakeholders

Jupyter Notebook Narrative

Write the markdown narrative cells for a Jupyter notebook about this analysis: [DESCRIBE THE ANALYSIS AND PASTE OR DESCRIBE THE CODE AND OUTPUT CELLS]. Each narrative cell should: introduce what the next code cell does and why, explain the output in plain language, highlight the most important insight from that cell, and connect it to the broader analytical story. Write narrative cells for: (1) the introduction and problem statement, (2) data overview, (3) key EDA findings, (4) modeling approach rationale, (5) results interpretation, and (6) conclusions and next steps.

Communication: Presenting Results to Stakeholders

Data Science Project README

Write a README for a data science project repository: [DESCRIBE THE PROJECT: WHAT PROBLEM IT SOLVES, WHAT DATA IT USES, WHAT MODEL WAS BUILT, WHAT THE KEY RESULTS ARE]. Include: (1) Project Overview (what it does and why it matters), (2) Key Results (the headline metric with context), (3) Project Structure (directory tree with one-line descriptions), (4) Setup Instructions (conda/pip environment, data download steps), (5) Usage (how to run training, evaluation, and inference), (6) Results Summary (model performance table), (7) Limitations and Next Steps. Keep it under 600 words. Every section should help a new team member get oriented quickly.

Communication: Presenting Results to Stakeholders

Frequently asked questions

What data science tasks is ChatGPT most useful for?+

EDA code generation, feature engineering patterns, scikit-learn pipeline construction, cross-validation setup, and translating results for non-technical audiences are where ChatGPT saves the most time. It is less reliable for cutting-edge research implementations, highly domain-specific feature ideas, and statistical reasoning that requires understanding your specific data distribution.

Can I trust ChatGPT to set up cross-validation correctly?+

Usually yes for standard setups, but always verify that preprocessing is inside the cross-validation pipeline, not outside it. The most common data leakage mistake in ChatGPT-generated data science code is applying transformations like scaling and imputation before cross-validation splits. Use the cross-validation setup prompt and check the code explicitly for this pattern.

How do I use ChatGPT to explain statistical concepts I do not understand?+

Ask it to explain concepts at the level of detail you need: "explain p-values in plain English for someone who knows statistics but is not a statistician" gives very different results than "explain p-values in the context of A/B testing for a product manager." Specify your background and the context you will apply the concept in.

Is ChatGPT good at writing pandas code?+

Yes, pandas is one of ChatGPT's strongest areas. Provide your DataFrame schema (df.dtypes and df.head()) as context. For complex transformations, describe the input structure and the desired output structure. ChatGPT generates idiomatic pandas with method chaining, but you should test the output on a sample of your actual data because edge cases with real-world data often differ from clean examples.

How do I prevent ChatGPT from generating code that looks correct but has subtle ML errors?+

The most dangerous ML errors are data leakage and evaluation metric choice. Explicitly ask ChatGPT to call out any data leakage risks in the code it writes, and always specify the metric you want to optimize and why. Ask it to flag any cases where the code would give misleadingly good results in evaluation but underperform in production.

More ChatGPT prompt guides

ChatGPT for WritingChatGPT for CodingChatGPT for MarketingChatGPT for BusinessChatGPT for ResearchChatGPT for Meeting SummariesChatGPT for Resume WritingChatGPT for Email MarketingChatGPT for YouTube ScriptsChatGPT for Job DescriptionsChatGPT for Ad CopyChatGPT for Study GuidesChatGPT for Business PlansChatGPT for Cold EmailsChatGPT for Cover LettersChatGPT for ProductivityChatGPT for Social MediaChatGPT for HealthChatGPT for FinanceChatGPT for TravelChatGPT for StudyingChatGPT for DebuggingChatGPT for Code ReviewChatGPT for Unit TestsChatGPT for SQLChatGPT for Technical WritingChatGPT for Instagram CaptionsChatGPT for LinkedIn PostsChatGPT for Twitter ThreadsChatGPT for TikTok ScriptsChatGPT for Newsletter WritingChatGPT for Data AnalysisChatGPT for PresentationsChatGPT for SEOChatGPT for Content StrategyChatGPT for Blog WritingChatGPT for Product DescriptionsChatGPT for AnalysisChatGPT for Brand VoiceChatGPT for Press Release WritingChatGPT for Podcast ScriptsChatGPT for Product Launch EmailsChatGPT for Win-Back CampaignsChatGPT for Welcome EmailsChatGPT for FreelancersChatGPT for ManagersChatGPT for EntrepreneursChatGPT for ConsultantsChatGPT for SalespeopleChatGPT for TeachersChatGPT for StudentsChatGPT for MarketersChatGPT for RecruitersChatGPT for HR ProfessionalsChatGPT for CopywritingChatGPT for Email WritingChatGPT for Creative WritingChatGPT for Academic WritingChatGPT for ScriptwritingChatGPT for Market ResearchChatGPT for Customer ServiceChatGPT for Project ManagementChatGPT for Competitor AnalysisChatGPT for BrainstormingChatGPT for Sales EmailsChatGPT for InterviewsChatGPT for FeedbackChatGPT for Strategic PlanningChatGPT for NegotiationsChatGPT for LawyersChatGPT for Real EstateChatGPT for Product ManagersChatGPT for ProposalsChatGPT for Executive SummariesChatGPT for Case StudiesChatGPT for White PapersChatGPT for UX WritingChatGPT for GrantsChatGPT for InfluencersChatGPT for PythonChatGPT for JavaScriptChatGPT for AutomationChatGPT for ExcelChatGPT for AccountingChatGPT for OperationsChatGPT for EcommerceChatGPT for StartupsChatGPT for Supply ChainChatGPT for NonprofitChatGPT for EngineeringChatGPT for HealthcareChatGPT for Personal BrandingChatGPT for OnboardingChatGPT for Book WritingChatGPT for EditingChatGPT for GhostwritingChatGPT for Landing PagesChatGPT for Thought LeadershipChatGPT for TypeScriptChatGPT for ReactChatGPT for API DevelopmentChatGPT for DevOpsChatGPT for DocumentationChatGPT for Customer SuccessChatGPT for Board PresentationsChatGPT for Change ManagementChatGPT for Financial ModelingChatGPT for Training ContentChatGPT for InsuranceChatGPT for HospitalityChatGPT for RetailChatGPT for MediaChatGPT for CybersecurityChatGPT for CoachingChatGPT for Public RelationsChatGPT for WebinarsChatGPT for Affiliate MarketingChatGPT for Event PlanningChatGPT for FitnessChatGPT for RecipesChatGPT for Personal FinanceChatGPT for Language LearningChatGPT for Mental HealthChatGPT for Learning SpanishChatGPT for Learning FrenchChatGPT for Learning GermanChatGPT for Learning JapaneseChatGPT for Learning PortugueseChatGPT for Weight LossChatGPT for ADHDChatGPT for College EssaysChatGPT for Side HustlesChatGPT for Retirement PlanningChatGPT for Learning ItalianChatGPT for Learning KoreanChatGPT for Learning MandarinChatGPT for Learning ArabicChatGPT for Learning HindiChatGPT for PregnancyChatGPT for DivorceChatGPT for GriefChatGPT for New ParentsChatGPT for MovingChatGPT for Making MoneyChatGPT for Passive IncomeChatGPT for FreelancingChatGPT for Starting an Online BusinessChatGPT for Digital ProductsChatGPT for Learning DutchChatGPT for Learning SwedishChatGPT for Learning PolishChatGPT for Learning TurkishChatGPT for Learning VietnameseChatGPT for Wedding PlanningChatGPT for Starting CollegeChatGPT for Job LossChatGPT for Chronic IllnessChatGPT for MenopauseChatGPT for Learning ThaiChatGPT for Learning RussianChatGPT for Learning IndonesianChatGPT for Learning TagalogChatGPT for Learning SwahiliChatGPT for Divorce RecoveryChatGPT for Navigating Empty NestChatGPT for Retirement TransitionChatGPT for Caregiver SupportChatGPT for Adoption JourneyChatGPT for DropshippingChatGPT for Content Creation IncomeChatGPT for Amazon FBAChatGPT for Print on DemandChatGPT for Fiction WritingChatGPT for Social Media MarketingChatGPT for SEO WritingChatGPT for Content MarketingChatGPT for RefactoringChatGPT for Code DocumentationChatGPT for Business PlanningChatGPT for Pitch DecksChatGPT for FundraisingChatGPT for Lesson PlanningChatGPT for TutoringChatGPT for Research PapersChatGPT for Online CoursesChatGPT for Goal SettingChatGPT for Time ManagementChatGPT for JournalingChatGPT for Habit BuildingChatGPT for Weight ManagementChatGPT for Mental WellnessChatGPT for Sleep ImprovementChatGPT for Nutrition PlanningChatGPT for Fitness PlanningChatGPT for Salary NegotiationChatGPT for LinkedIn Profile OptimizationChatGPT for Career Change PlanningChatGPT for Professional NetworkingChatGPT for Promotion StrategyChatGPT for BudgetingChatGPT for Investing as a BeginnerChatGPT for Paying Off DebtChatGPT for Tax PlanningChatGPT for Saving MoneyChatGPT for Novel WritingChatGPT for Character DevelopmentChatGPT for WorldbuildingChatGPT for Poetry WritingChatGPT for Story StructureChatGPT for Homework HelpChatGPT for Essay WritingChatGPT for Exam PreparationChatGPT for Twitter PostsChatGPT for Interview PreparationChatGPT for Welcome Email SequencesChatGPT for Cold Email OutreachChatGPT for Abandoned Cart EmailsChatGPT for Job SearchChatGPT for Meal PlanningChatGPT for Mental Health JournalingChatGPT for InvestingChatGPT for Financial PlanningChatGPT for Personal DevelopmentChatGPT Prompts for PlanningChatGPT Prompts for LegalChatGPT Prompts for OrganizationChatGPT Prompts for Content CreationChatGPT Prompts for TrainingChatGPT for Managing Life TransitionsAI Prompts for Learning NorwegianChatGPT Prompts for Pet Care