FunctionRacerProblemsRace

Crosstab Counts

MediumpandasPython

people has columns dept and level (both text). Return a dictionary that maps each department to a dictionary mapping every level in the table to how many people of that department have it (0 if none).

Example 1

people {"dept":["it","it","hr"],"level":["senior","junior","junior"]}
returns {"hr":{"junior":1,"senior":0},"it":{"junior":1,"senior":1}}

it: junior 1, senior 1. hr: junior 1, senior 0.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems