FunctionRacerProblemsRace

Count Salary Categories

EasypandasPython

accounts has columns id and income. Put each account in a band: "Low Salary" if income is below 20000, "Average Salary" if it is 20000 to 50000 inclusive, and "High Salary" if it is above 50000. Return a dictionary with all three band names as keys and the number of accounts in each (0 if none).

Example 1

accounts {"id":[1,2,3],"income":[15000,20000,90000]}
returns {"Low Salary":1,"Average Salary":1,"High Salary":1}

One account in each band.

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