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 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
Sur cette page du site, vous pouvez voir la vidéo en ligne Solving Python Data Analysis Interview Questions - Apple durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur MaKuData 03 décembre 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 716 fois et il a aimé 8 téléspectateurs. Bon visionnage!