Solving Python Data Analysis Interview Questions - Airbnb

Published: 26 November 2023
on channel: MaKuData
182
8

In this series, I will be solving python data analysis interview questions in Stratascratch. In this particular video, I'm solving Google's interview question.

If you have any questions or feedback regarding this content, please let me know in the comments or you can contact me directly via email: makunadata@gmail.com

My solutions to the mentioned questions are:
City With Most Amenities:
df = airbnb_search_details[['city', 'amenities']]
df['n_amenities'] = df['amenities'].apply(lambda x: len(x.split(',')))
df = df.groupby('city', as_index = False)['n_amenities'].sum().sort_values('n_amenities', ascending = False)
df.head(1)['city']

Ranking Most Active Guests:
df = airbnb_contacts[['id_guest', 'n_messages']]
df = df.groupby('id_guest', as_index = False)['n_messages'].sum().sort_values('n_messages', ascending = False)
df['rank'] = df['n_messages'].rank(ascending = False, method = 'dense')
df

Try out Stratascratch: https://stratascratch.com/?via=marius

Timestamps:
0:00 City With Most Amenities
6:40 Ranking Most Active Guests


On this page of the site you can watch the video online Solving Python Data Analysis Interview Questions - Airbnb with a duration of hours minute second in good quality, which was uploaded by the user MaKuData 26 November 2023, share the link with friends and acquaintances, this video has already been watched 182 times on youtube and it was liked by 8 viewers. Enjoy your viewing!