
Chris Parmer
2026-11-16
pandas demo
Data analysis with DataFrames in Python, with Dash and Plotly
TL;DR
- pandas is the Python library for working with tables: reading files, cleaning them, joining them and summarizing them by group or by time. Wes McKinney started it in 2008 at AQR Capital Management, it was open source by the end of 2009, and pandas 3.1.1 came out on November 4, 2026.
- It powers the reporting side of Dash apps in every field, from monthly operations reports and trading summaries to clinical trial trackers and lab instrument logs.
- With a coding agent you don't need to remember resample or pivot_table, but knowing what pandas can do lets you ask for the right thing. This post lists those capabilities, the prompts we used and other apps you can build.
- Our example is a monthly market report for the Texas power grid, built with an agent on 669 days of public hourly data.

What is pandas?
Most data that domain experts work with arrives as tables: hourly meter readings, trade blotters, lab results, patient visits, sensor logs. Before anyone can read it, someone has to load the files, fix the timestamps, join tables that don't quite line up, and boil millions of rows down to the hundred numbers that go in a report. That is the work pandas was built for, and today it's a community-run, NumFOCUS-sponsored project that much of the Python data ecosystem reads from and writes to.
Its core object is the DataFrame, a table with labeled columns and an index. When the index is time, pandas understands calendars, time zones and frequencies, so "daily peak", "monthly average" and "same month last year" are one line each. The kinds of Dash apps it shows up in include:
- Operations reports that turn raw time series into daily and monthly tables, with a download for Excel.
- Finance tools that join trades to prices and roll them up by desk, book or account.
- Clinical and lab trackers that count patients, samples or runs by site and week against a target.
- Sensor and instrument reviews that line up readings from different sources on one clock.
A coding agent writes the pandas code for any of these. Your job is to say what the report should show, and the next section gives you the words for that.
What's possible
These are the pandas capabilities a reporting app uses, in plain words, with the names to mention to your agent:
- Read anything: Excel, CSV, Parquet and JSON with read_excel, read_csv, read_parquet and json_normalize.
- Fix time: turn local timestamps into exact instants with tz_localize (including the repeated hour when clocks fall back) and convert them with tz_convert.
- Reshape: wide to long with melt, long to wide with pivot_table.
- Summarize by time: resample("D") or resample("MS") with agg, for daily and monthly numbers that respect daylight saving time.
- Summarize by group: groupby with named aggregations, and pd.cut to group by bins of a number.
- Join: join and merge on a shared index or key, and merge_asof for nearest-time joins.
- Compare: pct_change for year over year, rolling("7D") for moving averages and nlargest for the top rows.
- Export: to_excel with several sheets, so the report can be downloaded.
How to build a reporting app with pandas
The Electric Reliability Council of Texas (ERCOT) runs the grid for most of Texas and publishes its data as Excel files. We asked an agent to build a monthly market report from three of them, hourly load, real-time prices and generation by fuel, plus hourly temperatures for five Texas cities from Open-Meteo. It's a good test of pandas because every file has a different shape and ERCOT labels hours by when they end, in local time.
The first prompt does the data work:
Prompt: Download ERCOT's Native Load (2025, 2026), Fuel Mix (IntGenbyFuel2025/2026.xlsx) and Historical RTM Load Zone and Hub Prices (report 13061) files, and hourly temperature for Houston, Dallas, San Antonio, Austin and Midland from Open-Meteo. With pandas, turn each into an hourly table indexed by the UTC start of the hour. ERCOT times are "hour ending" in Central Prevailing Time. Use tz_localize("America/Chicago") with the repeated-hour flags for the November fall-back hour, then tz_convert("UTC"). The fuel mix has one column per 15 minutes: melt it to long, convert MWh per interval to MW, pivot_table by fuel, resample to hours. Average the four 15-minute prices in each hour with pivot_table(aggfunc="mean"). Save four Parquet files and print each table's shape, first and last timestamp and missing values.
Here's the time zone step. second marks the repeated hour in November:
start = pd.to_datetime(date) + pd.to_timedelta(hour_ending - 1, unit="h")utc = start.tz_localize("America/Chicago", ambiguous=~second, nonexistent="shift_forward").tz_convert("UTC")
Once all four tables share a UTC index, the app converts it back to Central time once, so resample("D") splits days at local midnight even on the short and long days of daylight saving time.
Page 1: the monthly report
The page at the top of this post is what a market analyst would send around at the start of each month: load, prices and the generation mix, each against the same month a year earlier, with an Excel download. It is one resample("MS") with named aggregations, and pct_change for the year-over-year comparison.
Prompt: Build a Dash app called ERCOT Market Report with tabs. The first tab is a monthly report: a month dropdown; five cards (average and peak load, average hub price, wind and solar share of generation, storage charging), each with the same month a year earlier; daily peak load bars with last year's days as a line; daily average hub price; and a table of the 8 highest-priced hours with load and wind plus solar at that hour (nlargest). Compute one monthly table with resample("MS").agg(named aggregations) and pct_change(12) for year over year. Add a button that downloads the month as Excel: a summary sheet, a daily sheet and the hourly data.

Further down, the nlargest table lists the month's highest-priced hours next to the load and the wind and solar output at that hour, which is usually the first thing someone asks about after a volatile month.
Page 2: generation by fuel

This page stacks a week of generation by fuel and then draws the month's average day with groupby(index.hour). In spring the average day shows the shape grid planners watch closely: net load (load minus wind and solar) dips at midday, and prices peak after sunset when it climbs back.
Prompt: Add a Generation tab: a week dropdown; hourly generation stacked by fuel (Nuclear, Coal, Gas-CC, Gas, Wind, Solar, Hydro, Biomass, Other) with storage charging (WSL) below zero and load as a line; then the month's average day with groupby(index.hour): load, net load (load minus wind and solar) and hub price on a second axis. Cards for the week's wind and solar share, solar peak, storage charging peak and lowest net load hour.
Page 3: prices

The heatmap is a single pivot_table with hours of the day as rows and dates as columns, which makes daily and seasonal patterns visible at a glance. Below it, a rolling("7D") mean tracks the price spread between any two hubs or zones you pick.
Prompt: Add a Prices tab: dropdowns for a hub or load zone and a second one to compare with, and a slider for the top of the color scale. Show a heatmap of price by hour of day (rows) and date (columns) with pivot_table, and the daily spread between the two with a rolling("7D") mean. Cards for the average price, hours below zero, the highest hour and the average spread.
Page 4: load and weather

Joining daily peak load to temperature and binning it with pd.cut separates demand growth from weather. On days of 95 to 100°F, peak load was 5.9 GW higher in 2026 than in 2025 at the same temperature.
Prompt: Add a Load and weather tab: join daily peak load to each day's highest temperature (the average of the five cities). Scatter peak load against temperature, colored by year. Then pd.cut the temperatures into bins (a slider sets the width), groupby(bin, year).mean() and draw one line per year. Cards for the number of days, days at 95°F and up per year, the hottest day and how much higher 2026 runs than 2025 at 95°F and up.
Other apps you can build with pandas
The same handful of functions carries over to reporting apps in other fields:
- Energy: a meter data review that resamples 15-minute interval data to billing periods and flags gaps (asfreq, isna, interpolate).
- Finance: a daily profit and loss (P&L) report that joins trades to end-of-day prices and rolls them up by desk (merge_asof, groupby, pivot_table).
- Pharma: a clinical trial enrollment tracker that counts patients by site and week against targets (groupby, resample("W"), cumsum).
- Manufacturing: a sensor log review that lines up machines' readings on one clock and averages them by shift (merge_asof, resample, cut).
- Science: a field station report that combines instrument CSV files with different time zones and units (read_csv, tz_convert, pipe).
For the math behind apps like these, our NumPy demo and SciPy demo work the same way, and our guide to Python packages for data covers the rest of the series.
What's new in pandas 3.1
pandas 3.1.0 came out on October 22, 2026, and 3.1.1 on November 4. From the release notes:
- Faster read_csv: a single-threaded read is typically two to three times faster than in 3.0, and large local files are now read in parallel on up to six cores by default.
- DataFrame.select returns chosen and computed columns, including pd.col() expressions, and filter takes a boolean mask through its new cond keyword, which makes method chains shorter.
- Groupby transform takes lists and dicts like agg does, with NamedFunc for named outputs.
- Periods format in f-strings, such as f"{period:%B %Y}", which the app's month dropdown uses.
- ExcelFile.parse is deprecated in favor of pd.read_excel.
Running pandas on Plotly Cloud and Dash Enterprise
What we learned deploying the app privately to Plotly Cloud, which applies the same way on Dash Enterprise:
- Ship Parquet, not the raw Excel. ERCOT's workbooks are 48 MB and slow to parse, while the four Parquet files are 4.8 MB and load almost instantly when the app starts.
- Store UTC, display local. One UTC index makes every join exact, and a single tz_convert at startup gives callbacks local days and hours.
- Precompute what doesn't change, and cap threads. Compute the monthly table once at startup so callbacks only slice it, and set pd.set_option("mode.max_threads", 1) if your app reads large CSV files inside callbacks on several workers.