Somebody has just given you access to a table called cust_txn_v2_final and asked for “a quick look at repeat purchases”. Your fingers want to start writing the query. Hold them back for twenty minutes. What you do in those twenty minutes is called profiling, and it is the cheapest insurance in analytics.

Profiling means describing a table’s shape and habits before you ask it anything clever. You are not looking for insights yet. You are finding out what the data is willing to say, and what it will quietly lie about. Let me walk you through how I would sit with you and do it, the way you would explain it to a new joinee on your team.

Start with size and grain

First question: how many rows, and what does one row represent? You already know that a row count by itself is not information. Say the table has 24 lakh rows. Is that 24 lakh orders, 24 lakh order lines, or 24 lakh daily snapshots of customers? The name will not tell you. Check the column that sounds like an identifier and compare its distinct count with the row count.

If order_id has 24 lakh rows and 24 lakh distinct values, it behaves like a key. If it has 24 lakh rows but only 9 lakh distinct values, then each order appears about 2.7 times on average, which strongly suggests one row per line item. Now every revenue total you compute from this table must be handled with that in mind, because counting rows would count items, not orders.

Also look for exact duplicate rows. A pipeline that was rerun after a failure often leaves two identical copies of a day’s data. It takes one grouping step to find them and saves you from a total that is mysteriously double.

Null rates, column by column

Next, for every column, compute the share of rows that are empty. Do this for all columns at once, not just the ones you plan to use. A column that is 2% empty is a nuisance. A column that is 62% empty is telling you something about how the data is collected, perhaps that it only applies to one channel or that it was added mid-year.

Here is the part freshers miss. Missing data does not always look missing. Old systems fill blanks with placeholders: the string “NA”, a single space, zero, the date 1 January 1900, a phone number of ten nines. Count the most frequent values in each column and the placeholders show up at the top of the list, looking like very popular customers. If 28,800 rows (1.2% of our 24 lakh) carry the same mobile number, you have found a default, not a loyal customer.

Ranges and shapes for numbers and dates

For every numeric column, note the minimum, maximum, median and a few percentiles. Then ask whether those make sense in the real world. A negative quantity might be a return, which is legitimate, or a bug. An order value of ₹0 might be a free sample. A maximum of ₹9,99,99,999 is almost certainly someone testing the system. You cannot decide which is which from the table alone; you write the question down and take it to the person who owns the source system.

Dates deserve their own look. Check the earliest and latest dates, and then count rows per month. A gap of two months in the middle means a load failed. A sudden jump in volume might be a genuine festival peak or a migration that loaded history twice. Dates in the future are common in transaction tables and usually mean a wrongly entered year or a time zone problem.

While you are there, compare related dates inside a row. A delivery date earlier than the order date is a data error, and a profile that checks such rules will find a handful in nearly every real table.

Low-cardinality columns: read the whole menu

For columns with few distinct values, such as status, channel, state or payment mode, just list every value with its count. You will often find that “Maharashtra”, “maharashtra”, “MH” and “Maharastra” all exist. You will find statuses nobody told you about, like “PARTIAL_REFUND”. You will also find that one value holds 94% of rows, in which case the column will not help you segment anything.

This is also where you spot categories that changed meaning. If “Online” was the only channel until mid-2023 and “App” and “Web” appear afterwards, a trend of “Online” orders will fall off a cliff for reasons unrelated to customers.

Join keys and referential checks

If you plan to join this table to a customer or product table, test the join before you rely on it. What share of customer IDs in the transaction table find a match? If 4% do not, those orders will disappear from any inner join, and your revenue will be short by roughly that share without any error message. Also check that the key on the other side is unique; if it is not, the join multiplies rows and inflates your totals.

What to write down

A profile is only useful if it ends as a short note, not as a dozen unsaved result tabs. Keep a plain list: the grain, the usable key, columns to avoid, placeholder values to exclude, date range with known gaps, and open questions for the data owner. When someone challenges a number three weeks later, this note is what lets you answer calmly.

You do not need special tools. A handful of grouping and counting queries covers everything above, and most notebook libraries and BI tools can generate a profile summary in one click. The click is fine as a start. But do read the output with your own eyes, because the tool cannot know that a mobile number of ten nines is a default and not a customer.

One last habit worth building: profile again whenever the source changes. A table that was clean in March can acquire a new status code in July. If you keep your profiling queries saved, rerunning them takes minutes, and you will catch the drift before your dashboard does.

Figures and names in the examples are illustrative.

Leave a Reply

Trending