Skip to main content
Thirdwatchthirdwatch
regulation

Analyze Federal Register Data With Python

Use pandas to measure regulatory activity by agency, document type, topic, and publication month.

Jul 21, 2026 · 1 min read · 243 words
See the scraper →

Export JSON from the Federal Register Scraper and keep the source-shaped table unchanged. Analysis should happen in a copy so arrays, nulls, and identifiers remain available for audit.

import pandas as pd

df = pd.read_json("dataset_items.json")
df["publication_date"] = pd.to_datetime(df["publication_date"], errors="coerce")\nagencies = df.explode("agencies")\nsummary = agencies.groupby([agencies.publication_date.dt.to_period("M"), "agencies"]).size()
print(summary if "summary" in locals() else wide.head())

Audit before charting

First check duplicate document_number values, missing dates, null numeric values, and unexpected units. Print a few rows from every transformation. An attractive chart can still be wrong because an array was counted as text or a missing observation became zero.

A search result is not a legal conclusion. Proposed rules, final rules, and notices have different effects. Preserve document type and official links so counsel or policy owners can review the actual publication.

When exploding arrays, keep the original row count nearby. An exploded table counts relationships, not source records. When pivoting, verify that the proposed index is unique; otherwise pivot_table will aggregate duplicates without asking what they mean.

Make comparisons honest

Use explicit denominators and label the time period. For a monitoring dataset, separate newly collected records from older records modified during the window. For numeric series, compare compatible definitions and units. For categorical counts, include an "unknown" bucket rather than dropping missing values.

Save the notebook, Actor input, dataset ID, and collection timestamp together. That small bundle is enough to reproduce the result later, which matters more than adding another visualization.

Frequently asked questions

Does this Actor use an official data source?

Yes. It queries the publisher's official public API and returns normalized records with traceable identifiers and source links.

Can I schedule this workflow?

Yes. Save the validated input as an Apify Task, attach a schedule, and compare each successful dataset with the previous snapshot.

Related

Try it yourself

100 free credits, no credit card.

About 30 real searches. Add the MCP to Claude or Cursor in two minutes.