Solving Python Data Analysis Interview Questions - Apple

Published: 03 December 2023
on channel: MaKuData
360
5

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: [email protected]

My solution to the problem:
Apple product counts:
df = playbook_events.merge(playbook_users, on = 'user_id', how = 'left')[['user_id','device', 'language']]
df['is_apple'] = df['device'].apply(lambda x: x.lower() in ['macbook pro', 'iphone 5s', 'ipad air'])

apple = df[df['is_apple']]
apple = apple.drop_duplicates('user_id')
apple = apple.groupby('language', as_index = False)['device'].count()

df = df.drop_duplicates('user_id')
df = df.groupby('language', as_index = False)['device'].count()

df = df.merge(apple, on = 'language', how = 'left', suffixes = ['_total', '_apple']).fillna(0)

df.sort_values('device_total', ascending = False)

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


Watch video Solving Python Data Analysis Interview Questions - Apple online without registration, duration hours minute second in high quality. This video was added by user MaKuData 03 December 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 360 once and liked it 5 people.