P

Prompt GitHub Copilot for Data Analysis

GitHub Copilot, the AI assistant developed by GitHub and OpenAI, is not limited to code generation. It is a powerful tool for analyzing data directly in your development environment. Whether you work with CSV files, SQL databases, or pandas DataFrames, Copilot can help you explore, clean, transform, and visualize your data without leaving your IDE. By formulating precise prompts, you can ask it to detect anomalies, calculate descriptive statistics, identify correlations, or generate relevant charts. Copilot's major advantage for data analysis lies in its ability to understand the context of your existing code: it adapts to the libraries you use (pandas, numpy, matplotlib, seaborn) and proposes analyses consistent with the structure of your data. This guide presents the best prompts to leverage GitHub Copilot in your data analysis tasks, from initial cleaning to creating actionable visual reports.

The prompt

GitHub Copilot

Analyze the DataFrame 'df' containing sales data. Perform the following steps: 1) Display a complete statistical summary (mean, median, standard deviation, quartiles) for each numerical column. 2) Identify missing values and propose a treatment strategy appropriate for each column's type. 3) Detect outliers using the IQR method and flag the affected rows. 4) Compute the correlation matrix between numerical variables and identify strongly correlated pairs (|r| > 0.7). 5) Generate a visual report with: a distribution histogram for each key variable, a correlation heatmap, and a time evolution chart if a date column exists. Use pandas, numpy, matplotlib, and seaborn. Comment each step of the code.

Personalize this prompt with Léa

Answer 3 questions and Léa tailors the prompt to your situation.

Why it works

This prompt is effective because it breaks down the analysis into clear sequential steps, allowing Copilot to generate structured and complete code. By specifying the expected libraries and precise thresholds (like |r| > 0.7 for correlations), ambiguity is eliminated and a directly usable result is obtained. The request for comments forces Copilot to produce documented and understandable code.

Expected result

You will obtain a complete Python script that loads your data, produces a detailed statistical summary, handles missing values and outliers, and then generates a series of professional visualizations. The code will be structured into reusable functions, commented at each step, and ready to be run in a Jupyter notebook or standalone script.

Variants by level

FAQ

Can GitHub Copilot directly analyze Excel or CSV files without prior code?
GitHub Copilot does not read data files directly, but it excels at generating the necessary code to load and analyze them. By writing a comment describing your file (columns, format, size), Copilot automatically suggests the appropriate pandas code with read_csv() or read_excel(), including relevant parameters like encoding, delimiter, or date parsing. For best results, open your data file in an adjacent tab so Copilot can infer the column structure.
How to get professional-quality visualizations with Copilot for my analyses?
To get high-quality charts, specify in your prompt the desired library (matplotlib, seaborn, plotly), the exact chart type, and the expected formatting elements (titles, legends, color palette, figure size). For example, explicitly request a seaborn style with the 'viridis' palette, annotations on key points, and high-resolution export (dpi=300). Copilot then generates complete and aesthetic visualization code, ready for a presentation or report.
Can Copilot help me clean dirty data before analysis?
Absolutely. Data cleaning is one of Copilot's most effective use cases. Describe the specific problems in your data in your prompt: duplicates, missing values, inconsistent formats, poorly typed columns, outliers. Copilot then generates a cleaning pipeline with appropriate pandas functions (dropna, fillna, drop_duplicates, astype, str.replace). For complex cases, specify your desired strategy: imputation by median, deletion above a missing value threshold, or standardization of date formats.

Related prompts

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. Replace the bracketed variables with your details, then refine the result.

About Prompt Guide

Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.

More prompts to explore

Go further

Get new prompts every week

Join our newsletter.