Skip to content

devlog/agent-loops/gemini-cli-and-a-notebook-beside-a-messy-orders-csv-277.md

Gemini CLI and a Notebook Beside a Messy Orders CSV

Gemini CLI and a Notebook Beside a Messy Orders CSV

A messy CSV usually arrives while I already have an editor, a terminal, and three unfinished tasks open. For an orders export with inconsistent dates, duplicate identifiers, and mixed currency formats, I want assistance without surrendering control of the data. Gemini CLI and a local notebook solve different parts of that problem. Here is the workflow I would use, and where each tool earns its screen space.

The orders.csv cleanup contract comes before either tool

Start with an immutable input at data/raw/orders.csv, a notebook at notebooks/clean_orders.ipynb, and a reusable module at src/clean_orders.py. Keep generated files outside the raw directory. Record the input file hash, pandas version, row count, and column names so another run can explain what changed.

Define the rules before asking for code: order_id must remain text, dates require a documented format and timezone policy, and monetary values need currency-aware parsing. Missing amounts are not zero. Repeated order identifiers are not automatically duplicate rows; they might represent line items.

Gemini CLI drafts transformations; the notebook exposes consequences

  • Gemini CLI is useful for inspecting project structure and proposing small, reviewable edits.
  • The notebook is useful for showing distributions, rejected values, and before-and-after samples immediately.
  • Gemini CLI makes repetitive refactoring easier once the cleanup rules are already explicit.
  • The notebook makes ambiguous business rules harder to hide behind plausible generated code.

In the terminal, ask: “Inspect the schema and existing tests. Propose a cleanup function without modifying raw files. Preserve identifiers, report parsing failures, and do not infer date formats.” Review file access and execution permissions before accepting tool actions. A prompt is not an access-control boundary.

In the notebook, load order_id with an explicit string dtype and inspect null counts, value counts, and representative date strings. For amounts, examine currency and decimal conventions before stripping punctuation. Removing every comma would silently corrupt values from some locales.

A notebook catches the mistakes a terminal diff cannot

Suppose the date column contains both 03/04/2026 and 2026-04-03. Neither interface can determine the first value’s intended meaning without a source contract. Have the CLI draft a parser that flags ambiguous values, then use the notebook to group those failures by source system. That view often reveals whether one exporter needs its own rule.

For duplicate handling, display every row sharing an order_id before choosing a key. Compare full-row duplicates separately from repeated business identifiers. Keep rejected records in a separate output with a reason column rather than quietly dropping them.

  • The terminal wins when a transformation needs tests and consistent application across files.
  • The notebook wins when a suspicious aggregate requires immediate inspection of underlying records.
  • Both lose when generated cleanup logic replaces an undocumented business decision.

Fluxo fits the model-access layer, not the validation layer

Fluxo provides one key and one base URL, https://api.fluxorelay.com, for Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok, and more. It works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK. For this workflow, Gemini 3.1 Pro is one concrete option for reviewing transformation logic; Gemini 3.8 Flash is another option to evaluate for narrower requests.

Use Fluxo’s documented Gemini CLI integration rather than assuming an OpenAI-compatible base URL alone configures the CLI’s native authentication and protocol. Keep keys in environment variables, never notebook cells or committed output. Local execution does not mean local inference: any samples sent to a hosted model leave your machine, so prefer schemas and synthetic examples.

Fluxo bills per real token, including cache reads and writes, with no monthly fee. Users also earn a referral share when people they invite pay. If that access model suits your terminal workflow, you can create a Fluxo account.

The verdict: notebook-led cleanup, CLI-assisted implementation

Use the notebook to establish evidence and approve rules; use Gemini CLI to turn those rules into maintainable code. Move accepted transformations into the module, add tests for ambiguous dates and preserved identifiers, then restart the notebook kernel and run every cell. Compare row counts, rejection counts, and totals by currency before exporting. For messy data, this pairing beats either tool alone—but the notebook should remain the inspection surface, not the production pipeline.

Next in the buffer

Sign up in a minute and get credit to try every model mentioned here. Sign up →