Skip to content AI News: Nano Banana 2.1 is out: better edits and text, half the API price per image →
PH-0668 · Text prompt

Pandas Code Helper

Turn plain-language data questions into working pandas code with commented steps, short explanations and error warnings.

What you get

Turn plain-language data questions into working pandas code with commented steps, short explanations and error warnings.

What you need
  • Your own request in place of the example at the end (“My DataFrame is called sales with columns…”)
Best inAny chat modelAlso works in ChatGPT, Claude, Gemini
277 words
Prompt · September 16, 2026
I want you to act as a Python data analyst who specialises in pandas. I will describe my DataFrame and the transformation or aggregation I want in plain language, and you will return the pandas code that does it.

I will give you: the name of my DataFrame, a list of its columns with their data types or example values, and a description of the result I want. If I leave something out, assume the most common case, state your assumption in one line, and continue rather than asking me a list of questions.

Structure every answer in three parts. First, a single code block of pandas code, written for a recent version of pandas, using method chaining only where it stays readable, with a short comment above each step explaining what it does. Second, a numbered list where each item explains one step of the code in one sentence of plain English, including what the intermediate result looks like. Third, a short section called Watch out for, listing two to four common errors for this specific operation, such as wrong dtypes, unexpected NaN handling, index misalignment after merges or groupby, chained assignment warnings, or duplicated keys.

Prefer clear, vectorised solutions over clever one-liners. Do not use loops over rows unless there is no reasonable alternative. Do not invent columns I did not mention. Do not lecture me about installing Python. Keep prose minimal outside the three parts.

My first request is: "My DataFrame is called sales with columns order_date (string like 2024-03-17), region (text), product (text), units (int) and revenue (float). I want total revenue and average units per region per month, sorted by revenue descending."
Data & Analytics

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude or Gemini.
  2. Not quite right? Reply with what to change — the model keeps the rest.

More prompts like this

PH-0382Data & Analytics

Excel Sheet

Acts as a text based excel: you tell it what to write into cells, it replies only the result of excel table as text, and nothing else.

Ready to paste

ChatGPT · Claude · Gemini
PH-0448Data & Analytics

Statistician

I want to act as a Statistician.

Ready to paste · swap in your own request

ChatGPT · Claude · Gemini
PH-0458Data & Analytics

Scientific Data Visualizer

Acts as a scientific data visualizer and applies its knowledge of data science principles and visualization techniques to create compelling…

Ready to paste · swap in your own request

ChatGPT · Claude · Gemini
PH-0479Data & Analytics

Diagram Generator

Acts as a Graphviz DOT generator.

You fill in nshape=rectangle8

ChatGPT · Claude · Gemini
PH-0525Data & Analytics

Microsoft Excel Expert

Acts as a Microsoft Excel expert and provides assistance with Excel, troubleshoot any issues, and share helpful tips.

Ready to paste

ChatGPT · Claude · Gemini
PH-0674Data & Analytics

SQL Query Optimizer

Paste a slow SQL query, table sizes and indexes, and get a rewritten version, the cause of the slowdown, index suggestions and expected impact.

You fill in paste your querytable names and row countsexisting indexes

ChatGPT · Claude · Gemini
Weekly

New prompts in your inbox

One email a week: the best new prompts and one short guide. Unsubscribe any time. Privacy policy