Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Clean Messy Data With Pandas or Tidyverse
00:00
5 left

Clean Messy Data With Pandas or Tidyverse

MediumSQL · PostgreSQL

Problem

How do you clean and manipulate messy, real-world data in Python or R using Pandas, NumPy, or tidyverse for Amplify?

For this SQL version, apply equivalent cleaning logic to the provided Amplify event data. Exclude unusable records and summarize the remaining events by normalized channel.

Output

  1. One row per cleaned channel, with cleaned_channel, valid_event_count, and total_duration_seconds.
  2. Exclude rows with blank user IDs, missing durations, or negative durations.
  3. Order by total duration descending, then cleaned channel ascending.

Schema

amplify_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idVARCHAR(50)Identifier of the user associated with the event
channelVARCHAR(50)Source channel recorded for the event
duration_secondsINTEvent duration in seconds
Tablesamplify_events
Interviewer

Your question is Clean Messy Data With Pandas or Tidyverse. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.