FunctionRacerProblemsRace

Person Cities

MediumpandasPython

people has columns id and name. addresses has columns person_id and city, with at most one address per person. Return a DataFrame with the columns name and city for every person, in the order of people. Use the text "Unknown" as the city of people with no address.

Example 1

people {"id":[1,2],"name":["Ana","Ben"]}
addresses {"person_id":[2],"city":["Oslo"]}
returns {"columns":["name","city"],"rows":[["Ana","Unknown"],["Ben","Oslo"]]}

Ana has no address.

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