What are the best ChatGPT prompts for data analysis?
ChatGPT prompts for data analysis help you write analysis code, create visualizations, interpret data, build statistical models, and communicate findings — turning AI into your data science assistant.
Whether you’re analyzing business metrics, conducting research, or exploring datasets, these 20+ ready-to-copy prompts will help you extract insights faster. Each prompt generates actionable code and analysis frameworks.
Why Use ChatGPT for Data Analysis?
- Faster coding — generate pandas, SQL, and visualization code instantly
- Analysis guidance — know which statistical method to use when
- Data cleaning — handle messy data with confidence
- Visualization — create compelling charts and dashboards
- Insight communication — translate data into stories
Data Exploration & Cleaning
1. Dataset Explorer
I have a dataset with the following columns:
[LIST COLUMNS WITH BRIEF DESCRIPTIONS AND DATA TYPES]
Size: [X] rows and [Y] columns
Source: [WHERE IT'S FROM]
Write Python code (using pandas) to:
1. Load and display basic info (shape, dtypes, memory usage)
2. Summary statistics for numerical columns
3. Value counts for categorical columns
4. Identify missing values (count and percentage)
5. Detect outliers using IQR method
6. Check for duplicates
7. Generate a data quality report
8. Suggest next steps based on what we find
2. Data Cleaning Pipeline
Help me clean this dataset. Issues I've identified:
- Missing values in: [COLUMNS]
- Duplicates: [YES/NO]
- Data type issues: [DESCRIBE]
- Inconsistent formatting: [DESCRIBE]
- Outliers in: [COLUMNS]
Write a Python cleaning pipeline that:
1. Handles missing values (with justification for each method: drop, fill with mean/median/mode, forward fill, etc.)
2. Removes or flags duplicates
3. Standardizes data types
4. Fixes formatting inconsistencies
5. Handles outliers (cap, remove, or flag)
6. Logs all transformations for reproducibility
7. Saves the cleaned dataset
8. Generates a before/after comparison report
3. Feature Engineering
I'm analyzing [DATASET DESCRIPTION]. Help me engineer new features:
Current columns: [LIST]
Suggest and implement:
1. Date/time features (day of week, month, season, time since event)
2. Aggregation features (rolling averages, cumulative sums, group statistics)
3. Interaction features (combinations of existing columns)
4. Encoding categorical variables (one-hot, label, target encoding)
5. Text features (if applicable: length, word count, sentiment)
6. Binning/binarizing continuous variables
7. Domain-specific features for [YOUR INDUSTRY/FIELD]
For each feature, explain why it might be useful for analysis.
4. SQL Query Builder
Help me write SQL queries for my analysis. My database has these tables:
[TABLE 1: columns and description]
[TABLE 2: columns and description]
[TABLE 3: columns and description]
I need to answer: [YOUR ANALYTICAL QUESTION]
Write queries for:
1. Basic data extraction with appropriate JOINs
2. Aggregation (GROUP BY with HAVING)
3. Window functions if applicable (RANK, LAG, LEAD, running totals)
4. Subqueries or CTEs for complex logic
5. Performance-optimized version with index suggestions
6. Expected output description
Statistical Analysis
5. Hypothesis Test Selector
I want to test: [YOUR HYPOTHESIS]
My data:
- Dependent variable: [NAME] (type: continuous/categorical)
- Independent variable: [NAME] (type: continuous/categorical)
- Sample size: [X]
- Data distribution: [normal/non-normal/unknown]
Help me:
1. Choose the right statistical test and explain why
2. Check assumptions for that test
3. Write Python code to run the test
4. Interpret the results (p-value, effect size, confidence interval)
5. Report the findings in plain English
6. Suggest alternative tests if assumptions are violated
6. Correlation & Relationship Analysis
Analyze relationships in my dataset:
Columns: [LIST WITH TYPES]
Target variable: [NAME]
Write Python code to:
1. Calculate correlation matrix (Pearson, Spearman, or Kendall as appropriate)
2. Visualize with a heatmap
3. Identify the strongest relationships
4. Test statistical significance of correlations
5. Create scatter plots for top 5 relationships
6. Check for multicollinearity
7. Suggest which relationships to investigate further
8. Warn about correlation ≠ causation
7. A/B Test Analyzer
I ran an A/B test and need to analyze results:
- Control group: [X] users, [METRIC] = [VALUE]
- Treatment group: [X] users, [METRIC] = [VALUE]
- Metric: [WHAT YOU MEASURED: conversion rate, click rate, revenue, etc.]
- Duration: [X] days
- Significance level: [0.05 or specify]
Analyze:
1. Is the result statistically significant?
2. Calculate p-value, confidence interval, and effect size
3. Check for sample ratio mismatch
4. Power analysis — was my sample size sufficient?
5. Practical significance — is the difference meaningful for the business?
6. Recommendation: ship, iterate, or run longer?
Write Python code for the full analysis.
8. Regression Analysis
Build a regression model for my data:
- Target variable: [NAME] (continuous/binary)
- Features: [LIST]
- Goal: [PREDICTION / UNDERSTANDING RELATIONSHIPS / BOTH]
- Data size: [X] rows
Write Python code for:
1. Exploratory data analysis of features vs. target
2. Train/test split with validation strategy
3. Model building (linear, logistic, or appropriate type)
4. Feature selection and importance
5. Model evaluation metrics (R², RMSE, MAE, or AUC, precision, recall)
6. Cross-validation
7. Residual analysis and diagnostics
8. Interpretation of coefficients in plain English
Data Visualization
9. Visualization Recommender
I want to visualize [WHAT YOU WANT TO SHOW: trend over time, comparison between groups, distribution, relationship, composition, etc.]
Data: [DESCRIBE YOUR DATA — columns, types, size]
Audience: [EXECUTIVES / TECHNICAL TEAM / GENERAL PUBLIC]
Tool: [MATPLOTLIB / SEABORN / PLOTLY / TABLEAU / EXCEL]
Recommend:
1. The best chart type for this data and message
2. Why this chart type works (and what alternatives to avoid)
3. Python code to create publication-quality visualization
4. Styling tips (colors, labels, annotations)
5. Common mistakes to avoid with this chart type
6. How to make it accessible (colorblind-friendly, clear labels)
10. Dashboard Design
Help me design a data dashboard for [PURPOSE: sales tracking, marketing performance, project status, etc.]:
- Metrics to display: [LIST]
- Data sources: [LIST]
- Refresh frequency: [REAL-TIME / DAILY / WEEKLY]
- Audience: [WHO WILL USE IT]
- Tool: [STREAMLIT / DASH / POWER BI / TABLEAU / EXCEL]
Design:
1. Dashboard layout (wireframe — text-based)
2. Which visualizations to use for each metric
3. Key filters and interactive elements
4. Color scheme and styling guidelines
5. Alert thresholds (when to flag something)
6. Python code for a basic version (if using Streamlit/Dash)
11. Chart Code Generator
Create [CHART TYPE: bar chart / line chart / scatter plot / heatmap / box plot / histogram / pie chart / treemap / etc.] using [MATPLOTLIB / SEABORN / PLOTLY]:
Data description: [DESCRIBE]
What to show: [THE MESSAGE/STORY]
Requirements:
1. Clean, professional styling
2. Proper labels, title, and legend
3. Color scheme that's colorblind-friendly
4. Annotations for key data points
5. Responsive sizing
6. Export-ready (high DPI)
7. Accessibility considerations
Provide complete, runnable Python code with sample data.
12. Storytelling with Data
Help me create a data presentation for [AUDIENCE]:
Key findings:
1. [FINDING 1]
2. [FINDING 2]
3. [FINDING 3]
Data available: [DESCRIBE]
Help me:
1. Structure the narrative (situation → complication → resolution)
2. Choose the right visualization for each finding
3. Write the key takeaway for each slide
4. Anticipate questions the audience might ask
5. Create an executive summary (3-4 sentences)
6. Suggest how to handle contradictory data
Specific Analysis Types
13. Time Series Analysis
Analyze this time series data:
- Metric: [WHAT YOU'RE MEASURING]
- Frequency: [DAILY / WEEKLY / MONTHLY]
- Time range: [START] to [END]
- Data: [DESCRIBE OR PASTE SAMPLE]
Write Python code for:
1. Decomposition (trend, seasonality, residuals)
2. Stationarity tests (ADF, KPSS)
3. Autocorrelation analysis (ACF, PACF)
4. Forecasting model (ARIMA, Prophet, or appropriate)
5. Model evaluation with train/test split
6. Forecast visualization with confidence intervals
7. Business interpretation of the forecast
14. Cohort Analysis
Help me perform a cohort analysis on my [E-COMMERCE / SAAS / APP] data:
Available columns: [e.g., user_id, signup_date, purchase_date, amount, etc.]
Create:
1. Define cohorts (by signup month, first purchase month, etc.)
2. Calculate retention rates by cohort
3. Build a retention matrix/heatmap
4. Revenue by cohort over time
5. Identify best and worst performing cohorts
6. Insights and recommendations based on patterns
7. Python code with visualization
15. Customer Segmentation
Help me segment my customers using this data:
Columns: [e.g., customer_id, recency, frequency, monetary_value, age, location, etc.]
Goal: [MARKETING TARGETING / PRODUCT DEVELOPMENT / CHURN PREVENTION]
Implement:
1. RFM analysis (Recency, Frequency, Monetary)
2. K-means clustering with optimal K selection (elbow method, silhouette score)
3. Segment profiling — who is in each segment?
4. Visualization of segments
5. Targeted strategy recommendations for each segment
6. Python code for the full analysis
16. Funnel Analysis
Analyze the conversion funnel for [PRODUCT/SERVICE]:
Steps:
1. [STEP 1: e.g., Landing page visit]
2. [STEP 2: e.g., Sign up]
3. [STEP 3: e.g., Onboarding complete]
4. [STEP 4: e.g., First purchase]
5. [STEP 5: e.g., Repeat purchase]
Data: [DESCRIBE AVAILABLE DATA]
Create:
1. Conversion rates between each step
2. Funnel visualization
3. Drop-off analysis (where are we losing people?)
4. Segmented funnels (by device, source, etc.)
5. Statistical significance of differences
6. Recommendations for the biggest drop-off points
7. Python code for the analysis
17. Sentiment Analysis
Perform sentiment analysis on [TEXT DATA: reviews, tweets, survey responses, etc.]:
Data: [DESCRIBE — source, size, format]
Language: [ENGLISH / OTHER]
Write Python code for:
1. Text preprocessing (cleaning, tokenization, stopword removal)
2. Sentiment scoring (using VADER, TextBlob, or transformer model)
3. Sentiment distribution visualization
4. Topic modeling to find common themes
5. Word cloud for positive vs. negative sentiments
6. Sentiment trends over time (if applicable)
7. Key quotes representing each sentiment category
8. Business recommendations based on findings
18. Survey Data Analysis
Help me analyze survey responses:
- Number of responses: [X]
- Question types: [multiple choice, Likert scale, open-ended, ranking]
- Key questions to analyze: [LIST]
- Demographics available: [LIST]
Create:
1. Response rate and completion analysis
2. Descriptive statistics for each question
3. Cross-tabulation analysis (e.g., satisfaction by age group)
4. Likert scale visualization
5. Open-ended response coding and themes
6. Statistical tests for key comparisons
7. Executive summary of findings
8. Python code for the analysis
Reporting & Communication
19. Analysis Report Generator
Help me write a data analysis report. My findings:
[LIST KEY FINDINGS WITH SUPPORTING NUMBERS]
Context: [WHAT WAS THE BUSINESS QUESTION]
Data used: [DESCRIBE DATASET]
Methods: [WHAT ANALYSES YOU RAN]
Create:
1. Executive summary (1 paragraph)
2. Introduction with business context
3. Methodology section
4. Key findings with supporting visualizations
5. Limitations and caveats
6. Recommendations (actionable, specific)
7. Appendix with detailed tables
Write for a [TECHNICAL / NON-TECHNICAL] audience.
20. Data Dictionary Creator
Create a data dictionary for my dataset:
Columns: [LIST ALL COLUMNS WITH SAMPLE VALUES]
For each column, document:
1. Column name and description
2. Data type
3. Valid range or categories
4. Missing value handling
5. Source and collection method
6. Known quality issues
7. Relationships to other columns
8. Business context and relevance
Format as a clean, reference-ready table.
21. Python Analysis Template
Create a reusable Python analysis template for [TYPE OF ANALYSIS: exploratory, reporting, monitoring, etc.]. Include:
1. Data loading with error handling
2. Configuration section (file paths, parameters)
3. Modular functions for each analysis step
4. Logging and progress reporting
5. Visualization functions
6. Export functions (CSV, Excel, HTML report)
7. Main execution flow
8. Requirements file
Make it production-quality: clean code, docstrings, type hints, and easy to modify for different datasets.
Frequently Asked Questions
Can ChatGPT replace data analysts?
ChatGPT is a powerful assistant for data analysts, not a replacement. It excels at generating code, suggesting analyses, and explaining concepts. But understanding business context, asking the right questions, validating results, and making strategic recommendations require human expertise.
How accurate is ChatGPT’s data analysis code?
ChatGPT’s code is generally solid for standard analyses (pandas, matplotlib, scikit-learn). Always verify the code runs correctly, check edge cases, and validate statistical methods. For complex or novel analyses, review the methodology with a statistician.
Can ChatGPT handle my specific dataset?
ChatGPT can help with any structured dataset — CSV, Excel, SQL databases, APIs, JSON. Describe your data structure and analysis goals, and it will generate appropriate code. For very large datasets (millions of rows), mention the size so it can suggest efficient methods.
Should I trust ChatGPT’s statistical advice?
ChatGPT’s statistical guidance is based on established methods and is generally reliable for common analyses. For advanced or specialized statistics (survival analysis, Bayesian methods, causal inference), verify with a statistician. Always check assumptions before applying any test.
How do I learn data analysis with ChatGPT?
Start with the Dataset Explorer prompt on a dataset you’re curious about. Ask ChatGPT to explain every step. Practice with different analysis types. Use the Learning prompts to understand concepts. Build projects and ask for feedback. The combination of doing and explaining accelerates learning.