
Handling a Weather API With Nested Arrays of Measurements
Weather APIs return columns as parallel arrays. Turn them into rows with pandas and DuckDB, handle nulls and unequal lengths, and keep units and zones.
Tag
134 posts

Weather APIs return columns as parallel arrays. Turn them into rows with pandas and DuckDB, handle nulls and unequal lengths, and keep units and zones.

Clean a social media archive that is JavaScript, not JSON: strip the assignment, join parts, fix string numbers and dates, unescape HTML and write Parquet.

Flatten a Shopify style export of 20,000 orders into orders and line items with pandas and DuckDB: money as strings, null customers, tags and zones.

Load JSON fixtures into PostgreSQL for tests with jsonb_populate_recordset: 25,000 rows in 0.21 s, bad fixtures caught by constraints, one typo missed.

Test a JSON API against its OpenAPI contract with Schemathesis: 1,903 generated requests found a 500 and undocumented statuses, and missed one bug.

Make quick charts from a large CSV: aggregate in DuckDB, plot with matplotlib or draw text bars in the terminal, and keep the charts honest.

Test whether a CSV column follows a normal distribution using skew, kurtosis, percentiles and Shapiro-Wilk, and why a huge file always fails the test.

Two ways to load a CSV into DynamoDB: the S3 import that makes a table of string attributes, and a boto3 batch writer with Decimal numbers.

Call a SOAP service from Python with zeep: load the WSDL, call an operation, get typed results, handle a Fault, see the request envelope,.

Generate JSON test data with Faker, Hypothesis, SQL and jq: seeds for repeatable runs, collisions, and a property test that found real bugs.

Compare JSON documents in tests while ignoring ids and timestamps: strip keys, DeepDiff exclusions, placeholders that keep relations, jq del, float tolerance.

Snapshot tests for JSON in pytest with syrupy and Node's test runner: what a snapshot stores, why random ids break it, and matchers and scrubbing that fix it.