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
На этой странице сайта вы можете посмотреть видео онлайн Solving Python Data Analysis Interview Questions - Apple длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь MaKuData 03 Декабрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 716 раз и оно понравилось 8 зрителям. Приятного просмотра!