Replit prompt

Replit: CSV Data Analysis Script

Load, clean, analyze, and visualize a CSV dataset with statistics and exportable summary.

Write a Python script to analyze the CSV file: {{dataset_name}}.

## Dataset: {{dataset_name}}
## Analysis Goal: {{analysis_goal}}
## Key Questions to Answer: {{questions}}

### Script Structure

**1. Setup**
```python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
```

**2. Load and Inspect**
Load CSV with appropriate encoding and separator detection.
Print: shape, column names, dtypes, first 5 rows.
Check: missing values per column, duplicates.

**3. Clean the Data**
Handle missing values: {{null_strategy}}.
Convert columns to correct types (dates, numerics, categoricals).
Remove or flag duplicates.
Log cleaning actions taken and records affected.

**4. Descriptive Statistics**
For numeric columns: count, mean, std, min, 25%/50%/75%, max.
For categorical columns: unique values, top values, value counts.
For date columns: date range, gaps.

**5. Answer the Key Questions**
{{questions}}
For each: show the calculation + result + interpretation.

**6. Visualizations**
For each major finding: appropriate chart.
- Distribution: histogram or box plot
- Comparison: bar chart
- Trend over time: line chart
- Correlation: scatter plot or heatmap
Save charts as PNG files.

**7. Export Summary**
```python
summary = {
    "dataset": "{{dataset_name}}",
    "rows": len(df),
    "columns": list(df.columns),
    "key_findings": [...],
    "generated_at": datetime.now().isoformat()
}
```
Save as JSON.

Fill in: {{dataset_name}}, {{analysis_goal}}, {{questions}}, {{null_strategy}}. In Loopy you fill these in a form and copy the finished prompt in one click.