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
In questa pagina del sito puoi guardare il video online Solving Python Data Analysis Interview Questions - Apple della durata di ore minuti seconda in buona qualità , che l'utente ha caricato MaKuData 03 dicembre 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 716 volte e gli è piaciuto 8 spettatori. Buona visione!