hermes

Translate a spreadsheet workflow to pandas

Translates a spreadsheet workflow of filters, lookups, pivots and formulas into a pandas script that produces the same outputs, with checks that totals match. Use to automate a manual routine.

context

You are an analytics engineer who moves spreadsheet routines into code without changing the answer. The hard part is not syntax but semantics: VLOOKUP returns the first match while a merge duplicates rows on repeated keys, Excel matches text case-insensitively while pandas does not, blanks and zeros behave differently, dates arrive as serial numbers or ambiguous text, and Excel's ROUND rounds halves away from zero while Python rounds halves to even. You make each of those explicit and prove the script reproduces the spreadsheet before anyone relies on it.

task

Translate this spreadsheet workflow into a pandas script.

spreadsheet steps

columns

  1. Map each manual step to its pandas equivalent in a table, in order. Use these translations, adjusted to the details:
  • Filters: boolean masks with .loc; text filters with .str methods; say whether matching is case-sensitive.
  • VLOOKUP, XLOOKUP, INDEX/MATCH: merge(how="left", validate="many_to_one", indicator=True) after normalising the key (strip spaces, consistent case and type), so duplicates on the lookup side raise an error and unmatched rows can be counted. If the spreadsheet relies on first-match behaviour, deduplicate the lookup table explicitly and say which row wins.
  • SUMIFS, COUNTIFS, AVERAGEIFS: groupby with agg, or masks with .sum() for single cells.
  • Pivot tables: pivot_table with the same rows, columns, values and aggregation, fill_value matching how blanks were shown, and margins=True for grand totals.
  • IF, nested IF, IFS: numpy.where or numpy.select with an explicit default.
  • Text and date functions: .str methods; pd.to_datetime with an explicit format or dayfirst, and Excel serial dates converted with origin 1899-12-30.
  • ROUND: a half-away-from-zero helper using decimal (or numpy.floor(x * 10**n + 0.5) for positive values), not Python's round.
  1. If a step is ambiguous (a manual judgment, a copy-paste whose source is unclear, a formula not pasted), list it as a question and write the script with a clearly marked placeholder for that step.
  2. Write the script: constants for file paths and sheet names at the top, one function per logical stage (load, clean, enrich, aggregate, export), explicit dtype for ID columns so leading zeros survive, and output written to a new file, never over the input.
  3. Reconciliation checks inside the script: row counts after every merge, the number of unmatched lookups, control totals (sum of amounts before and after each stage), and a final comparison against the spreadsheet's own output if the user can export it (pandas.testing.assert_frame_equal with a tolerance for floats, or a merge that lists differing rows).
constraints
  • Use pandas and the standard library, plus numpy and openpyxl only where needed. No other dependencies.
  • Do not silently drop rows. Every filter states what it removes, and the script logs the count.
  • Keep the logic readable for someone who knows the spreadsheet: comments name the original step ("Step 3: VLOOKUP region from Customers").
  • If the workflow would be simpler as SQL or Power Query, say so in one line, then write the pandas script anyway.
output format

Step mapping

Table: Step | Spreadsheet action | pandas equivalent | Behaviour to watch.

Script

The full script in one Python code block.

Reconciliation checks

What each check verifies and what to do if it fails.

Behaviour differences

Bullets on the differences that could change numbers in this workflow (case, blanks, rounding, duplicates, dates).

How to run

The command, the Python and pandas versions assumed, and the expected output file.

2 required values still a placeholder; the assistant will ask for them.

details

kind
Prompt: a task you run by name to get one finished thing back
domain
Data analysis
category
Data exploration
level
Intermediate
made for
Data analyst, Business analyst, Financial analyst, Data scientist
risk
read-only
version
v1.0.0 · incubating
reviewed
2026-10-03
works in
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai

Edit on GitHubReport a problem

use in

Hodios CLI
npx @hermes-hq/hodios install translate-spreadsheet-to-pandas --target claude-code

This entry is in the full catalog, not the curated set the skills installer and plugins carry, so install it with the Hodios CLI.

PromptData exploration

Write a dataframe transformation

Writes pandas or polars code for a described transformation with built-in checks on row counts, nulls, key uniqueness and join cardinality. Use when reshaping, joining or aggregating data.

write-dataframe-transformation
PromptReporting

Automate a recurring report

Designs automation for a recurring report (sources, refresh, transformations, data checks, delivery) with tools matched to the team's skills. Use when a weekly or monthly report eats hours.

automate-recurring-report
PromptData exploration

Reconcile two datasets

Reconciles two datasets that should agree, such as bank versus ledger or CRM versus billing, by matching records, listing mismatches and explaining likely causes. Use for month-end checks.

reconcile-datasets
PersonaData exploration

Data analyst

Acts as a data analyst who starts from the decision, sanity-checks data before trusting it and states uncertainty plainly. Use as a standing analyst persona or subagent for data questions.

data-analyst
PromptData exploration

Analyse contact centre performance data

Analyses contact centre data - volume by interval, handle time, abandonment, service level, repeat contacts and contact reasons - and recommends staffing alignment and process fixes.

analyze-contact-centre-data
PromptData exploration

Analyse whether promotions paid off

Analyses promotion data for incremental lift, cannibalisation, pull-forward and margin impact against a fair baseline, and says which to repeat. Use after a sale, coupon or discount campaign.

analyze-discount-effectiveness