
Making Quick Charts From a CSV With Python and DuckDB
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.
Tag
92 posts

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.

Sample a large CSV for a quick first look: why the top rows mislead, random and reproducible sampling in DuckDB, and how the error shrinks with sample size.

Rank customers by revenue in a CSV with SQL, compute cumulative share and the top 10 percent, handle ties and refunds, and read the concentration curve.

Compare this month with last month from a CSV in SQL without being fooled by day counts, open periods or weekday mix, using 2 million real rows.

Find weekly and monthly rhythms in daily sales from a CSV: a weekday index, autocorrelation at lag 7, what a flat result looks like and how to adjust for it.

Build a cross tab of two CSV columns with DuckDB PIVOT, add row totals and percentages, and test with chi-square whether the two columns are really related.

Nine analysis moves for a CSV in SQL: cross tabs, period comparisons, concentration, seasonality, distribution shape, sampling, charts and reconciliation.

Open a CSV in VisiData to scroll, sort, filter and profile it from the keyboard, build frequency tables, and save results, plus its batch mode for scripts.

Handle amounts in several currencies: keep the original amount and code, convert once with a dated rate, never sum mixed currencies and show the rate.

Load Excel timesheets into a database cleanly: one row per person, day and project, hours as decimals, validation of codes and limits, and approvals kept.

Write a rounding policy an auditor can follow: where to round, which tie rule, per line or per total, and how to test it in Excel, Python and SQL.