You ask in plain words
With whatever notes or documents you already have.
How many rows will I get if I join these two tables?
Predict a left join on id. Blanks never match.
Your notes
left.id: A, A, B, C, <blank> right.id: A, A, B, <blank>
Your agent answers with a checked method
It runs 4 checks before it replies.
Your agentUsing this skill
Expect seven output rows from four left rows. The two A contacts each produce two matches. C and the blank key each remain as one unmatched row. Check whether both right-hand A records are legitimate before joining.
- Using the number of distinct keys hides multiplication, especially where both tables contain repeated keys.
- Removing duplicates to force a desired row count can discard legitimate records. Trace the relationship first.
- Assuming pandas and SQL agree. pandas matches null keys to each other; SQL equality does not, so unmatched counts can differ even when the row count is the same.
- Joining a key stored as text on one side to numbers on the other. Depending on the engine the keys fail to match or the join raises an error.
Why that’s right. Two left A records each match twice. The C and blank records are retained unmatched.
Is it the right skill?
What it’s for, and when another skill or a person is the better choice.
Use it when
- Someone is about to join two tables, merge two spreadsheets or add a lookup table and wants to know the output row count.
- A join returned more rows than the left table and someone wants to know why.
- Keys may be duplicated or blank on either side.
Not the right skill when
- Checking a single spreadsheet lookup formula. Use the lookup table skill.
- Inner, right or full outer joins without restating the method. The counts here are for a left join, which keeps every left row.
The method it follows
6 steps, in order, every time.
- Count how often each key occurs on each side. Keep key values in their declared type and treat blank as missing when the contract says so.
- Look for differences the engine treats as distinct keys, such as text versus number, trailing spaces or case, and report them rather than silently fixing them.
- Confirm the null policy. SQL equality never matches a null to a null, because NULL = NULL is unknown rather than true; pandas merge matches null keys to each other. State the policy before giving a row count.
- For each key present on both sides, multiply the left count by the right count. Add one row for each unmatched left record, including blanks when nulls do not match. The sum is the expected output.
- List each left key once where a right-hand duplicate creates extra rows, and count the left records without a match.
- After the join, compare the actual row count with the prediction. In pandas, validate='many_to_one' stops a merge whose right-hand keys are not unique.
What to have ready
If something’s missing, your agent asks before it starts.
- Left and right key columns, including duplicates and blanks.
- Join type, match policy for null keys and expected relationship.

Which columns are the join keys on each side, and are they stored as the same type?

Which join type and engine will run it, such as SQL, pandas or Power Query? They treat blank keys differently.

Should a blank key ever match another blank key?

What relationship do you expect, such as one customer to many orders? It shows which duplicates are legitimate.
Try it on your own AI
A new question with a known answer, so you can check your AI gets it right.
-
Copy the questionPredict a left join using pandas null matching. <blank> is a null value. Return only JSON following the skill’s test format. left.id: <blank>, D right.id: <blank>, <blank>, D
-
Ask your AI in a new chat
Give it this skill first, then paste the question. It replies with a short block of data in the format the skill asks for.
-
Show the answer and why
Here the null matches two right-hand records under the requested merge policy.
{
"left_rows": 2,
"joined_rows": 3,
"unmatched_left_rows": 0,
"multiplied_keys": [
null
]
}
The check runs in your browser. Nothing you paste is sent anywhere.
Where the method comes from
Free to use and adapt with credit (CC BY 4.0).
Use this skill in Raq.com
Add it to your Skill Library and your agent applies it whenever a request matches. Edit it for your own business and keep every version.