Interview Query

First Names Only

Have you seen this question before?

You’re given a dataframe containing a list of user IDs and their full names (e.g. ‘James Emerson’).

Transform this dataframe into a dataframe that contains the user ids and only the first name of each user.



user_id name
1034 James Emerson
9430 Fiona Woodward
7281 Alvin Gross
5264 Deborah Handler
8995 Leah Xue


user_id name
1034 James
9430 Fiona
7281 Alvin
5264 Deborah
8995 Leah
Next question: Decreasing Payments
Python 3.9.6
Loading editor
Use Shift + Enter to run code