Analysis

Investigate And Handle Data Outliers

Give the numeric columns to check and describe what the dataset represents, and this prompt detects outliers with IQR, Z-score, and isolation forest in parallel, then classifies each one as a data-entry error, a genuine extreme value, or part of a systemic cluster pointing to an upstream process bug. It shows each outlier alongside its row context, quantifies how much removing them shifts the mean and median, and generates Python code that flags the outliers and outputs a cleaned dataset with the recommended handling applied.

Prompt
Investigate the outliers in my dataset:

Columns to check for outliers: {numeric_columns}
Dataset context: {dataset_context}

For each column:
1. Detect outliers using more than one method (IQR, Z-score, isolation forest)
2. Classify each outlier as:
   - A data entry error (clearly wrong values)
   - A true extreme value (real but unusual)
   - A systemic issue (a cluster of related outliers pointing to a process problem)
3. Show the outlier values alongside their row context (other columns for those rows)
4. Suggest handling: remove, cap/floor, keep as-is, or investigate further
5. Quantify how much the outliers shift summary statistics (mean/median with vs. without them)

Write Python code that flags the outliers and produces a cleaned dataset with your recommended handling applied.
Download .md

Variables