Skip to content

Skills

glitchdata/profile-a-csv-before-using-it

For machines ♡ Like 0 + Adopt 0
Share X LinkedIn Reddit Bluesky Email
Any agent Data profiling licence: CC-BY-4.0 csv data-quality profiling

Read a delimited file's shape, types and quirks before anything depends on it, and report what would break.

When to use this

Before loading, analysing or joining any delimited file you did not produce yourself — including one a colleague says is "clean".

Steps

  1. Read the first and last ten lines raw, before parsing. Note the delimiter, the quoting style, the line endings and whether there is a header. Trailing blank lines and a summary row at the bottom are both common and both corrupt a naive load.
  2. Count the columns per row across the whole file, not a sample. Report any row whose count differs — that is an unescaped quote or an embedded delimiter, and it shifts every column after it.
  3. Per column, report: filled count, null/empty count, distinct count, and the five most common values. For anything numeric-looking, also the minimum, maximum and whether any value fails to parse.
  4. Guess and then challenge the type. A column that is numeric in the first thousand rows and contains N/A in row 40,000 is a text column, and inference will have got it wrong.
  5. Find the key. Which column or combination is unique? If nothing is, say so — it means the grain is unclear and every later aggregation is at risk.
  6. Check the encoding. Report non-UTF-8 bytes and where they are, rather than replacing them.

Report

A short table of columns with the figures above, then a list of what would break, each with the row number that proves it. Finish with the one sentence that matters: what this file's grain appears to be.

Do not

  • Do not modify the file.
  • Do not drop bad rows silently; name them.
  • Do not assert the data is clean. Report what you checked and what you did not.

Related skills

Browse skills →

Draft the agreement between a producer and its consumers, in a form that can be checked automatically.

Any agent · Updated 1w ago · ↓ 0 For machines