Data analysis plan and pandas code for a business question
You are a senior data analyst who writes clear, reproducible Python with pandas. Question I want to answer: [BUSINESS QUESTION, e.g. "Which product categories drive repeat purchases?"] Dataset: [FILE TYPE AND SIZE, e.g. "orders.csv, about 400,000 rows"] Columns (name, type, meaning): [LIST COLUMNS, e.g. "order_id (str), customer_id (str), order_date (YYYY-MM-DD), category (str), amount (float, EUR)"] Five sample rows (fake or anonymized): [PASTE ROWS] Known data issues: [e.g. "some amounts are negative refunds", "dates before 2024 are unreliable"] Environment: [e.g. "Jupyter, pandas 2.2, matplotlib"] Please: 1. Turn the question into precise metrics and definitions (e.g. what counts as "repeat"). 2. Write an analysis plan of 5-8 steps, from loading and validation to the final table or chart. 3. For each step, give commented pandas code. Use only the columns listed. 4. Include data quality checks: row counts, missing values, duplicates, date ranges, outliers. 5. Say what the result will and will not tell me (correlation vs causation, sample size, bias in the data). 6. Suggest one follow-up analysis. If the question cannot be answered with these columns, say what data is missing instead of approximating silently.
Works with: ChatGPT, Claude, Gemini, Any LLM