Data Interview Qs - Formatting dirty data

Formatting dirty data
Data Analysis Python Pandas Data Manipulation

Suppose you have the following dataset which contains which contains (1st tab) a list of items purchased by a given user, (2nd tab) a mapping which maps the item_id to the item name and price.

Can you format the data into a matrix with users in rows and the items they purchased into columns along with the frequency of the purchase for each type of item?

For example, if we have a user with the following row:

user_id ids
12345 1, 4, 4, 3, 5, 5, 5

We would want the output to look like the following:

user_id 1 2 3 4 5
12345 1 0 2 2 3

Solution will be written in python for premium users.




Want the solutions? Upgrade to premium to access detailed solutions to each problem (including this one).

Was this email forwarded to you? You can join our list here to receive questions


Unsubscribe

Older messages

The carshare dilemma

Wednesday, October 7, 2020

Data Interview Qs The carshare dilemma Statistics Probability Theory Suppose we have selected a group of people to take a survey. 35% of the group like Uber, 20% like both Lyft and Uber, and 25% like

Predicting churn with a decision tree

Monday, October 5, 2020

Data Interview Qs Predicting churn with a decision tree Python Product Metrics Pandas Data Analysis External Dataset Machine Learning Classifers Decision Tree Given the following dataset, can you

Tallying up absent students using SQL

Friday, October 2, 2020

Data Interview Qs Tallying up absent students using SQL SQL Database Querying Given the following table schemas, pull a list of students with the most absences in descending order. You can filter out

Data Interview Questions: Problem #76

Wednesday, September 30, 2020

Data Interview Qs The Weather Report Data Analysis Python Pandas Data Manipulation Data Visualization External Dataset Suppose you have the following dataset, which contains information about a

Data Interview Questions: Problem #75

Monday, September 28, 2020

Data Interview Qs Students in a class Statistics Probability Theory Set Theory In a class of 120 students numbered 1 to 120, all even numbered students opt for Physics, those whose numbers are

You Might Also Like

WP Weekly 192 - WP Biz - Brands Merged, Woo Cart Popup, Fastest Hosting

Monday, May 6, 2024

Read on Website WP Weekly 192 / WP Biz The 'business of WordPress' is buzzing for sure, be it the acquisition of plugins or the massive Envato ownership change. Also, WordPress content brands

SRE Weekly Issue #423

Monday, May 6, 2024

View on sreweekly.com A message from our sponsor, FireHydrant: FireHydrant is now AI-powered for faster, smarter incidents! Power up your incidents with auto-generated real-time summaries,

⚠️ Avoiding AI Scams on Social Media — An Open Source Google Photos Alternative

Sunday, May 5, 2024

Also: Reviewing the Customizable Drop Mechanical Keyboard, and More! How-To Geek Logo May 5, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to

Daily Coding Problem: Problem #1432 [Medium]

Sunday, May 5, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This question was asked by Snapchat. Given the head to a singly linked list, where each node also has a “random”

PD#572 Good Ideas in Computer Science

Sunday, May 5, 2024

Ideas every programmer likes and why Garbage Collection and Object Oriented Programming don't count ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

RD#454 API Layer & Fetch Functions

Sunday, May 5, 2024

ixing API and UI code quickly leads to messy and unmaintainable code ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

The Shiny Toy Syndrome & Tiny macOS utility apps I love

Sunday, May 5, 2024

Lex launching its redesign, Raycast shares another monthly update packed with AI updates, prompts should be designed not engineered, and a lot more in this week's issue of Creativerly. Creativerly

Hyundai antes up $1B for AV startup Motional and Elon unplugs the Tesla Supercharger team

Sunday, May 5, 2024

Plus, layoffs come for Luminar, Fisker and Ola View this email online in your browser By Kirsten Korosec Sunday, May 5, 2024 Image Credits: Motional Welcome back to TechCrunch Mobility — your central

C#504 Adventures serializing absolutely everything in C#

Sunday, May 5, 2024

A fantastic journey porting Newtonsoft.Json to System.Text.Json ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Sunday Digest | Featuring 'Which City Has the Most Billionaires in 2024?' 📊

Sunday, May 5, 2024

Every visualization published this week, in one place. Visual Capitalist Sunday Digest logo May 5, 2024 | View Online | Subscribe | VC+ The Best of This Week's Visuals Presented by Voronoi: The