Skip to content
Start free

What one row is in a support log

A help desk log says 10. Find out what one row stands for before you call it tickets.

2 parts · 6 and 3 min

Free course. Your Maestro, an AI, .

A help-desk lead exported the week's support log into a table named events and asked an AI how many tickets the team handled that week. The AI answered 10 and showed the code it ran: len(events).

In Python, len(events) counts the rows in the table. Whether 10 answers the lead's question depends on the table's : what a single row stands for. A file exported from a help desk often logs more than one row per ticket, and len(events) counts every row in the table regardless of what each row records.

Before you accept a row count as a ticket count, run two checks on the table:

  1. Row count vs. distinct IDs. Compare the total number of rows from len(events) with the number of distinct ticket IDs from events["ticket_id"].nunique(). When a table has more rows than distinct IDs, the same ticket appears on multiple rows.
  2. The two-rows test. Pick two rows that share the same ticket ID and compare the remaining columns. What changes from one row to the next tells you what causes a new row to be added to the log.

Try it

Run the code below to print the events table, the row count, and the count of distinct ticket IDs. Then uncomment the last line, print(events.groupby("ticket_id").size()), and run the script again to see how many rows each ticket has.

Use the result to complete this sentence in your own words: "One row of this log is one ___." If you want to verify your sentence before moving on, share it with your Maestro.

Your turn

Run the code. Then print how many rows each ticket_id has. You're done when you can say what one row stands for and how many tickets there really are.

A good place to stop. Up next: part 2 of 2 · 3 min

What the output shows

Running the starter code prints Rows: 10 and Distinct tickets: 4. Uncommenting print(events.groupby("ticket_id").size()) shows how those 10 rows divide across the 4 tickets:

  • Ticket "T1" has 3 rows ("opened", "reply", and "closed", all handled by Ana).
  • Ticket "T2" has 2 rows ("opened" and "closed", both handled by Bo).
  • Ticket "T3" has 4 rows ("opened", "reply", "reply", and "closed", handled by Ana and Cy).
  • Ticket "T4" has 1 row ("opened", handled by Bo).

Apply the two-rows test to the rows that share ticket ID "T3". The ticket ID stays "T3" on all four rows, while the event column steps through "opened", "reply", "reply", and "closed", and the agent column switches between Ana and Cy. That difference gives you the grain sentence: one row of this log is one event inside a ticket, and the log tracks 4 distinct tickets.

Watch out for two traps when you inspect a log like this:

  • Assuming a filled-in ID column is unique. Because every row has a value in ticket_id, a quick scan can make the table look like a list of 10 tickets. In an event log, the ticket ID repeats every time a new step happens on that ticket.
  • Mistaking a column with fewer values for the grain. Only three names appear in agent (Ana, Bo, and Cy), so agent names repeat across tickets and across events within the same ticket. Only the combination of a ticket and a specific event explains why each row exists. If you want to talk through how to spot the grain column in a new table, ask your Maestro.

When the AI ran len(events), it counted all 10 logged events ("opened", "reply", and "closed") and reported them as 10 handled tickets, overcounting the 4 tickets in the table.

Check yourself: Two rows in the support log share ticket_id "T3". What differs between them, and what does that tell you one row stands for?

Now that you have checked what one row stands for, the next pages turn to the AI's code itself: reading its filter and group steps line by line, and recomputing its number a second way.