Dfwatcher: The Silent Observer for Pandas Pipelines

Your Pandas Pipeline Is Losing Data — And You Don’t Know Where :woozy_face:

Data pipelines fail quietly — Rows disappear, schemas drift, nulls shift, joins explode, and memory balloons often without a single warning until the final numbers are already wrong and by then you have no idea which step caused it:thinking: .

dfwatcher : :shushing_face: Silently Watch Every Step of Your Data

dfwatcher is a zero-config diagnostic library that watches your pandas pipeline functions. Just decorate them. It automatically tracks:

  • Row counts before ➜ after (with signed diff and %)
  • Null-count deltas per column
  • Schema drift (columns added or removed)
  • Dtype changes
  • Join explosions (which key, which values, how many times)
  • Memory deltas (RSS or peak)
  • Threshold guards (warn or hard-stop on excessive loss/gain)

It works with plain functions, sessions that group an entire pipeline run, and custom handlers for logging or CI.

Two ways to use it:

  1. @watch on individual steps — instant visibility
  2. session("name") — full pipeline summary + machine-readable results for assertions

It never changes your data or your logic. It only reports. You decide what to do.:thinking:

Current state and limits:

  • dfwatcher v0.1.1
  • Focused on pandas (Polars / DuckDB backends planned)
  • Default overhead is low; memory tracking is optional
  • It diagnoses. It does not auto-fix the pipeline.
  • Best experience with the [rich] or [full] extras for coloured terminal output

Repo: GitHub - Abineshabee/watcher: 😶 Watcher: The silent data watcher for pandas pipelines. Decorate your functions and instantly see how your data changed—rows, schema, nulls, memory, joins, and more—with zero configuration. · GitHub

pip install dfwatcher
        or
pip install "dfwatcher[full]"

Decorate. Run. Read the report. Stay in control.

From Abineshabee — :slightly_smiling_face: feedback and issues welcome.

1 Like

This is a really clean and practical solution to a pain point almost anyone running complex Pandas transformations has hit in production. Silent row drops during inner merges and unintended dtype upcasting (like integer columns quietly coercing to float64 due to introduced NaNs) often slip past unit tests and only surface once downstream dashboards break.

Quick question regarding runtime overhead on large DataFrames: When chaining operations across sizable datasets (say millions of rows), does dfwatcher compute the null/schema validation metrics eagerly on every transformation step, or is there an option to configure row sampling / lazy metrics to avoid memory pressure in high-throughput pipelines? Also, are there plans to allow exporting step anomalies directly into structured logs or OpenTelemetry spans?

Great initiative and look forward to tracking the project!

2 Likes

Thanks for the thoughtful questions, and sorry for the delay. I wanted to answer with measurements instead of claims.

1. Overhead on large DataFrames

Setup: a 3-step pipeline (filter, join, groupby) on 100K to 10M rows, default settings, best of 3 runs, with peak RSS measured.

What I found:

  • Metrics are computed on every step. Null counts and dtype changes already use a 50,000-row sample on larger frames, but the join-explosion check (which runs only when a step gains rows) does exact counts on the full frame, and it is the main cost.
  • Runtime is roughly 3.6x to 3.9x the plain pipeline from 1M rows up. At 10M rows it went from about 2.7s to 10.6s. It is higher on small data (about 5x at 100K) because of fixed per-step cost.
  • Peak memory is about 30% higher at scale (roughly 1.23 GB to 1.6 GB at 10M rows).
  • This pipeline’s join adds rows, so it triggers the most expensive check. Steps that don’t add rows skip it.

2. Structured logs / OpenTelemetry

Every step is available as structured data through session.steps. Here it is dumped to JSONL, with the join explosion captured as fields (offending key columns, duplicate-key flag, null deltas, schema diff, timing, memory):

Native OpenTelemetry export isn’t built in yet. Custom handlers (HandlerBase with on_step / on_session_end) already receive each step record, and the fields map naturally to span attributes (rows_in, rows_out, join_explosion, and so on). A JSON handler is on the roadmap, and an OTel handler is the natural follow-up.

Native OpenTelemetry export isn’t built in yet. Custom handlers (HandlerBase with on_step / on_session_end) already receive each step record, and the fields map naturally to span attributes (rows_in, rows_out, join_explosion, and so on). A JSON handler is on the roadmap, and an OTel handler is the natural follow-up.

From Abineshabee :slightly_smiling_face:

Thanks again for the feedback. This is exactly the kind of testing the project needed.

1 Like

Really appreciate you taking the time to run actual empirical benchmarks on 10M rows rather than estimates — that level of transparency is rare and super helpful.

The 50k-row sampling for nulls/dtypes paired with gating full-frame scans strictly to row-expanding joins strikes a very sensible trade-off between visibility and throughput. The ~30% peak memory overhead at scale also looks quite manageable for standard batch ETL jobs.

Good to know that session.steps already structures the metadata cleanly; writing a custom HandlerBase bridge into OTel span attributes sounds straightforward in the interim until the native handler lands.

Kudos again on shipping this, will definitely be following the repo releases!

1 Like