Skip to main content

Python Data Pipeline with Pandas

Build a data transformation pipeline using Pandas — cleaning, validation, enrichment, and export with configurable processing stages.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to build a multi-stage Pandas data pipeline rather than a one-off cleaning script. It defines six ordered stages: ingest from [input_format], clean (nulls, duplicates, outliers via [outlier_method]), validate against [validation_rules], transform with [transformations], enrich from [enrichment_source], and export to [output_destination] — all processed in [chunk_size]-row chunks with quality checks between stages and a profiling report.

The structure works because it separates the pipeline into discrete, inspectable stages instead of one tangled transform. The [data_source] variable frames what you're processing, [outlier_method] and [validation_rules] make cleaning and validation explicit and auditable, and [chunk_size] keeps memory bounded on large, messy datasets. Quality checks between stages are what stop a silent corruption from flowing all the way to [output_destination].

When to use it

  • You're processing real, messy data and want a staged pipeline you can inspect at each step.
  • You need chunked processing to handle datasets too large to load into memory at once.
  • You want validation against [validation_rules] so bad rows are caught, not exported.
  • You're enriching records from an external [enrichment_source] and need that as a discrete stage.
  • You need error recovery for partial failures rather than an all-or-nothing run.

Example output

Expect a structured Python pipeline: an ingest function for [input_format], a cleaning stage applying [outlier_method], a validation stage checking [validation_rules], transform and enrichment stages, and an export to [output_destination]. Processing iterates over [chunk_size]-row chunks, data-quality checks sit between stages, a profiling report summarizes the run, and logging plus partial-failure recovery keep a long job debuggable — code organized stage by stage, not a single monolithic function.

Pro tips

  • Set [chunk_size] to your memory budget — the default of 10000 is a safe start; raise it for speed, lower it if you hit limits.
  • Be explicit in [validation_rules] (types, required fields, ranges); vague rules let bad data slip through the quality gates.
  • Match [outlier_method] to your data's distribution — IQR suits skewed data, z-score suits roughly normal data.
  • Name a real [enrichment_source]; if it's a rate-limited API, plan for caching and the enrichment stage to handle failures.
  • Keep [output_destination] honest — writing to both PostgreSQL and Parquet (the default) means designing two writers, so drop one if you don't need it.
  • Read the between-stage quality checks and tune their thresholds before trusting the profiling report on production data.

Frequently Asked Questions

How does it handle datasets too big for memory?
The pipeline processes data in chunks of the size you set in `[chunk_size]`, defaulting to 10000 rows. This keeps memory bounded so you can run it on large files without loading the entire dataset at once and exhausting RAM.
What outlier detection methods are supported?
Whatever you specify in `[outlier_method]`, defaulting to the IQR method. Choose based on your data's distribution: IQR works well for skewed data, while a z-score approach suits roughly normal distributions. The cleaning stage applies your chosen method.
How does it prevent corrupted data from reaching the output?
It runs data-quality checks between stages and validates rows against your `[validation_rules]` before transformation. Combined with a profiling report, this surfaces problems mid-pipeline rather than silently exporting bad records to `[output_destination]`.
Can it recover if a run fails partway through?
Yes. The prompt requests error recovery for partial failures alongside logging, so a chunk or stage that fails does not necessarily discard all prior progress. Review the recovery logic to confirm it matches how you want re-runs to behave.
Can it write to multiple output destinations?
Yes. The `[output_destination]` variable defaults to both PostgreSQL and Parquet files, meaning the pipeline includes two writers. If you only need one destination, simplify the variable so the AI doesn't build an export path you won't use.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Python & Automation Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support