Python · Practice Studio
A real code runner for the data-engineering Python you'll actually write, test, and defend — not LeetCode puzzles.
Revisit records, contracts, and idempotency first — 15 chapters written for data engineering, not web dev.
Open the Python knowledge baseTurn a messy raw event feed into one clean, ordered record per event.
Make every row carry the same columns, and surface the fields the schema never declared.
Merge per-run overrides onto a nested config template, leaving the template unchanged.
Count measurements into buckets when the boundaries arrive unsorted and values sit exactly on them.
Turn a dimension table into a keyed lookup that reports duplicate and unusable keys.
Decide which Hive-style partition a row belongs in when its timestamp carries any zone.
Turn a run's counts into a manifest whose rows balance and whose status can be alerted on.
Valid Parentheses over a raw JSON-like payload, ignoring brackets inside quoted strings.
Turn a hand-edited header row into safe, unique snake_case column names.
Run-length encode per-minute health checks so each outage becomes one run with a length.
Build a rejection report where each call is independent, and a supplied batch is extended.
Count a raw event feed by type when the producer writes the same type several ways.
Count sorted event timestamps inside [start, end) with two lower-bound binary searches.
Drop repeated rows by a composite key while keeping the order the file arrived in.
Intersect two sorted customer-id exports in one walk, returning each shared id once.
Slide a fixed-width window over per-minute request counts to find the peak k minutes.
Report which days in a range have no partition, from a listing that is unsorted and imperfect.
Longest common prefix over object-store keys, cut back so the answer is a real folder.
Produce a digest per record that depends on its contents and not on key order.
Collect the distinct composite keys from records whose fields may hold lists or dicts.
Find the two settled payments whose amounts add up to a refund, in one pass with a dict.
Combine defaults, environment settings and run-time flags without losing the keys nobody overrode.
Parse NDJSON, report the lines that will not decode, and re-emit the rest byte-stably.
Parse real CSV text into records, trimming whitespace and rejecting rows missing a required field.
Turn a logfmt-style line into typed fields, including the value somebody put spaces in.
Convert fields to declared types, collecting failures as records with enough context to find them.
Compute the waits between retries so a failing dependency is not hammered and the job still ends.
Report completeness and variety per column so a bad load is visible before anyone queries it.
Rank rows on three keys with mixed directions, so the same input always ranks the same.
Compare source and warehouse row counts and classify every difference rather than just listing them.
Mask personal fields anywhere in a nested record so debug logs stay safe to keep.
Turn raw byte counts from object storage into sizes a person can compare at a glance.
Add a cumulative balance to each row without letting one account's total leak into the next.
Turn a sorted list of signed forecast errors into sorted error sizes in one pass.
Group rows for a sink that caps both the number of rows and the bytes per request.
Group rejections by reason, biggest first, with a bounded sample of each and a deterministic order.
Rank rows by a numeric field so the same input always produces the same leaderboard.
Sum order amounts per region when the amounts arrive in more than one type.
Split a load file into rows that satisfy a declared schema and rows that say why they do not.
Write rows inside a context manager that closes however the block ends, and report the manifest.
Split a total into whole minor units proportionally, so the parts add back to exactly the total.
Bucket events by when they happened, not when they arrived, and divert what turned up too late.
Kadane's maximum subarray over a daily ledger, with exact tie-breaks and the all-loss case.
Merge a customer's records from three systems into one, choosing each field from the best source that has it.
Build a validator function per column from a spec, then run them and report the failures.
Select rows for an incremental load using a watermark, a replay window and a dedupe on id.
Count the contiguous runs of days whose net ledger movement equals a target, with prefix sums and a Counter.
Daily Temperatures over event volumes: a monotonic stack of waiting days answers each in one pass.
Compare two versions of a source schema and say which changes break the readers downstream.
Say exactly what changed between last night's table and tonight's, field by field.
Flatten one row per order into one row per item without silently losing the empty orders.
Find the shortest run of consecutive micro-batches whose combined size reaches a target file size.
Rank the k most frequent error codes in an alerting log, counting with a dict and selecting with a heap.
Find the index of the smallest sequence number in a wrapped ring buffer in O(log n).
Find every distinct set of three invoice line amounts that adds up to a payment, credits included.
Return the first and last position of a repeated partition key in a sorted index with two binary searches.
Flatten arbitrarily nested payloads to dotted keys without losing empty containers.
Walk a cursor-paginated source to the end, terminating on a cycle, a gap or a page limit.
Carry the last reading across short gaps in a sensor feed without inventing hours of data.
Group raw log lines by their message template by hashing a normalised key, busiest template first.
Join orders to a customer dimension and report the row-count change the join caused.
Find the longest contiguous stretch of a clickstream in which no page is visited twice.
Find a user's longest run of consecutive active calendar days from an unordered, duplicated list of dates.
Find the longest run of consecutive requests that only ever touched k or fewer backend hosts.
Find the pair of events from two sorted logs whose timestamps are closest, in one walk.
Collapse a service's overlapping downtime windows into the smallest set that covers the same time.
Convert timestamps that arrive with Z, with an offset, or with nothing at all into one UTC form.
Summarise an event feed with itertools.groupby, which groups adjacent runs rather than keys.
Turn a dependency map into a run order, and name the tasks that can never run at all.
Reshape one-row-per-measurement into one-row-per-day without inventing zeroes.
Group a partition's small files into rewrite units that respect both a size target and a file limit.
Replay a request log through a token bucket per tenant and decide what would have been throttled.
Compare a source extract against the warehouse copy and classify every key, including the repeats.
Resolve a stream of lookup keys against a slow source, hitting it once per distinct key.
Wrap an attempt in a retry decorator that backs off, respects a cap, and keeps the wrapped identity.
Group each user's events into sessions from a feed that arrives in no useful order.
Find the tightest time span in a merged log that contains at least one entry from every required service.
Binary search on the answer: the smallest daily row quota that processes ordered partitions within a deadline.
Keep the top n rows per key using a heap, so memory is bounded by n rather than by the feed.
Smooth a noisy per-service metric without letting one service's window reach into another's.
Convert raw rows into a declared record shape with typed fields, defaults and recorded warnings.
Replay a metric through a fire-and-clear state machine so a one-sample spike does not page anybody.
Merge a batch of versioned changes into a snapshot so that replaying it changes nothing.
Credit each conversion to the last marketing touch before it, inside a lookback window.
Turn a change feed into validity intervals, without inventing versions that never existed.
Recommend threads, processes, asyncio or sequential per workload, respecting the machine's limits.
Group a run's failures against a policy, surface the types it does not know, and advise on retrying.
Write only the rows a sink has not already taken, so a retried batch changes nothing.
Merge log segments down to the newest version per key, keeping the deletes that are still load-bearing.
Drop duplicates inside a sliding window while keeping a key that legitimately returns.
Audit a consumed stream for missing offsets, duplicate deliveries and producer restarts.
Compare produced rows against a golden set by key, and describe the difference field by field.
Enrich orders with the customer attributes in effect when the order happened, not today's.
Produce one globally sorted stream from many sorted shards without loading them all.
Compute p50, p95 and p99 per endpoint so the Python report matches the SQL one.
Decide exactly which tasks a corrected table forces you to rerun, and in what order.
Work out where a batcher flushes under three competing limits, and which limit caused each flush.
Choose the next increment from a high-watermark column when several rows share the same timestamp.
Simulate a bounded worker pool giving each task to the worker free soonest, and report the makespan.
Decide the smallest set of partitions that can satisfy a query, without ever skipping one that could.
Work out which keys change node when the cluster grows or shrinks, and why it should be few.
Cross a declared rule set against the test cases and report the gaps, not just the coverage.
Derive one schema that reads a whole table when every month's files were written differently.