employees holds each person's salary and their department_id; departments maps each id to a department name. Find the absolute difference between the highest salary in Marketing and the highest salary in Engineering, and store that number in result.
The data
employees10 rows
| idint64 | first_nameobject | salaryfloat64 | department_idint64 |
|---|
| 1 | Priya | 98000 | 2 |
| 2 | Tom | 121500 | 1 |
| 3 | Ines | 87000 | 2 |
| 4 | Kofi | 134000 | 1 |
| 5 | Mei | NaN | 2 |
| 6 | Raj | 76000 | 3 |
and 4 more rows
departments3 rows
| idint64 | nameobject |
|---|
| 1 | Engineering |
| 2 | Marketing |
| 3 | Sales |
Target output
np.float64(5000.0)
What this question tests
Tests a merge on keys with different names and a group maximum, with two small traps: a missing salary, and the word "absolute". It is a common first question because it is short enough to finish and still separates people who check their join from people who hope.
More Python interview questions