Skip to content
The Latent Daily
The Latent Daily

Sections

News & Industry
Knowledge & Learning
Research & Science
Tools, Software & Models
Developers & Builders
Hardware & Infrastructure
Society, Policy & Ethics
AI in Industries
People & Community
Special Formats

Tag

#Pandas

Pandas on The Latent Daily: 3 prompts. News, explainers and guides on Pandas, each linked to its sources.

3 items

Prompts tagged #Pandas

Data analysisadvanced

Cohort retention analysis plan with SQL or pandas

You are a product analyst. Help me plan and build a cohort retention analysis. Product and business model: [e.g. "subscription meal-kit app", "B2B SaaS with monthly plans", "free mobile game"] Question I want to answer: [e.g. "did users who signed up after the new onboarding retain better?"] Data available (tables and key columns): """ [e.g. users(user_id, signup_at, country, plan), events(user_id, event_name, event_at)] """ Tool: [SQL DIALECT, OR "Python pandas"] Date range: [START AND END] Steps: 1. Propose the cohort definition (what event and date puts a user in a cohort) and explain alternatives. 2. Propose the "retained" definition: which activity counts, and whether retention is classic (active in period N) or rolling (active in period N or later). Recommend one for my question. 3. Choose the time grain (day, week, month) and justify it from how often a healthy user should return. 4. Explain how to handle the most recent cohorts that have not had time to reach later periods, time zones, and users with no activity. 5. Write the query or code that outputs a cohort table: cohort, cohort size, and retention % for periods 0..N. 6. Explain how to read the table, what patterns to look for, and which comparisons would be misleading. 7. List checks to validate the result (e.g. cohort sizes match total signups).

Works with: ChatGPT, Claude, Gemini, Any LLM

Data analysisintermediate

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

Data analysisintermediate

Data cleaning plan for a messy CSV

You are a careful data engineer. I need to clean a CSV file before analysis. What the data is: [SHORT DESCRIPTION, e.g. "customer sign-ups exported from our CRM"] What I will use it for: [THE ANALYSIS OR SYSTEM IT FEEDS] Approximate size: [ROWS AND COLUMNS] Tool I will use: [e.g. Python with pandas, R, Excel, SQL] Here are the header and a sample of rows (including some problem rows): ``` [PASTE HEADER + 20-50 ROWS] ``` Step 1 - Profile: for each column give the likely meaning, expected type, and problems you can see (missing values, mixed formats, inconsistent categories, outliers, duplicates, encoding issues, leading/trailing spaces). Step 2 - Plan: a numbered cleaning plan ordered by impact. For each step say what changes, why, and how many rows it might affect. Step 3 - Decisions for me: list choices that depend on business rules (e.g. drop or impute missing values) with your recommended default. Step 4 - Code: write [TOOL] code that applies the plan, keeps the original file unchanged, and logs how many rows each step changed or removed. Step 5 - Checks: list validation checks to run after cleaning. Base your profile only on the sample; say clearly when a problem may exist in rows you have not seen.

Works with: ChatGPT, Claude, Gemini, Any LLM