Coding

Data Analysis — Python Script for Analysing a Dataset

Generate a complete Python data analysis script for any dataset. Covers data cleaning, exploratory analysis, visualisations, and key insights.

Fill in your details

0/3 filled

Fill in the fields below. The preview on the right updates live as you type.

Live Preview

UnfilledFilled
Act as a senior data scientist who writes clean, well-documented Python code for data analysis. Create a complete analysis script for the following dataset.

**Dataset Description:** [DESCRIBE YOUR DATA — what it contains, how many rows/columns approximately, where it comes from]
**File Format:** [CSV / Excel / JSON / SQL / Parquet / API]
**Key Columns:** [LIST THE MOST IMPORTANT COLUMNS AND THEIR DATA TYPES — e.g. "date (datetime), user_id (int), revenue (float), country (string)"]
**Analysis Goal:** [WHAT BUSINESS QUESTION ARE YOU TRYING TO ANSWER?]
**Specific Analysis Needed:** [e.g. "Find which products have declining sales", "Identify customer churn patterns", "Correlate marketing spend with revenue"]

Generate a Python script that:

1. **Data Loading** — Load the dataset with pandas, handle file path as a variable

2. **Data Cleaning:**
   - Check for and handle missing values (with strategy for each column type)
   - Remove duplicates
   - Fix data types (especially dates)
   - Handle outliers (flag, cap, or remove — with justification)

3. **Exploratory Data Analysis:**
   - Summary statistics for numeric columns
   - Distribution checks
   - Time-series trend if date column present
   - Correlation matrix

4. **Core Analysis** — Answer the stated business question with appropriate methods

5. **Visualisations** — 3–4 charts using matplotlib/seaborn with clear titles, labels, and colour choices

6. **Key Findings** — Print a summary of 5 insights from the analysis

7. **Next Steps** — Comment block suggesting further analysis

Include all import statements. Add a `requirements.txt` block at the top as a comment.

3 fields remaining

How to use this prompt

  1. 1Fill in your details in the form above — the prompt preview updates as you type.
  2. 2Check the live preview to confirm all fields are filled correctly.
  3. 3Click "Copy prompt" and paste directly into ChatGPT.