Data · 25 tools · nothing uploads

Pivot a CSV

Pivot a CSV: one column's distinct values become row labels, another's become column headers, and a third is aggregated into each cell by count, sum, mean, min, or max. Runs entirely on your device.

Input

Options

live

Pivot a CSV reshapes long data into a cross-tab. The column named in rows supplies the row labels; the one named in columns supplies the headers. A third column, named in values, feeds each cell through whichever statistic you pick: sum, mean, min, max or count. Anything but count needs values set. Sum, mean, min and max quietly skip non-numeric cells.

Questions

What do rows, columns and values control?

rows picks the column whose values become row labels, columns picks the one whose values become column headers, and values picks the column that gets aggregated into each cell.

When is values required?

Whenever agg is anything other than count; count works without a values column since it counts rows.

What aggregations are available?

Count, sum, mean, min and max, chosen with the aggregate option and applied to the value column you name.

What happens to non-numeric cells under sum or mean?

They are silently dropped from the calculation, so a bucket with only non-numeric values in that column comes back blank.

What if rows or columns does not exist in the file?

It is refused, naming the missing column and listing the file's real headers.

What does the output include?

Both a downloadable pivoted CSV and a summary line stating the row and data-row counts, plus how many row and column labels resulted.

Related Data tools

1→1Reorder / insert CSV columnsReorder (and drop) a CSV's columns by name, and optionally insert one new column with a constant value at a given position. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Map CSV column namesRename a CSV's header to a new schema ("old=new" pairs), and optionally drop every column that isn't named in the mapping. Column order and data are otherwise untouched. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Change CSV separatorRe-delimit a CSV (comma, semicolon, tab or pipe), auto-detecting the current separator when not told what it is. Quote-aware. A record with a quoted field containing a literal newline (including in the header) stays one record.Takes one file1→1Transpose CSVSwap a CSV's rows and columns. Column 1 becomes row 1, and so on. A ragged row (fewer cells than the widest row) is padded with empty cells rather than refused. Quote-aware. A record with a quoted field containing a literal newline stays one record, not two.Takes one file1→1Split CSV into partsCut a CSV into several smaller files of N data rows each, repeating the header in every part. Quote-aware: a record with a quoted field containing a literal newline stays one record.Takes one filen→1Merge CSV filesConcatenate several CSVs with the same header into one file, in the order given. Quote-aware. A record with a quoted field containing a literal newline stays one record.Combines the files you drop1→1Remove duplicate CSV rowsStrip repeated rows from a CSV. Compares whole records, not physical lines, so a quoted field containing a newline is one record and stays one record.Takes one file1→1Find incomplete CSV recordsReport every record whose cell count doesn't match the header: too few cells (a truncated record) or too many (an unescaped comma). Read-only: nothing is changed. Quote-aware, so a record with a quoted field containing a literal newline still counts as one record with the right cell count.Takes one file