Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Download, Clean, and Transform Data with Pandas
00:00
5 left

Download, Clean, and Transform Data with Pandas

MediumSQL · PostgreSQL

Problem

Write code that downloads data from an API and cleans it up (e.g. transform with pandas).

Asked in the Power Day technical stage. For this SQL exercise, assume the API response has been loaded into raw_api_transactions, with customer reference data in customer_reference. Clean the records by validating fields, retaining the latest duplicate, and excluding records without a valid customer match.

Output

  1. One row per retained transaction with transaction_id, customer_id, customer_name, occurred_at, amount, and status.
  2. Include only valid monetary amounts, parseable timestamps, accepted statuses, and matched customers.
  3. Sort by occurred_at ascending, then transaction_id ascending.

Schema

raw_api_transactions
ColumnTypeDescription
transaction_idVARCHAR(30)Transaction identifier received from the API
customer_idVARCHAR(20)Customer identifier received from the API
amount_textVARCHAR(30)Transaction amount as raw text
occurred_at_textVARCHAR(40)Transaction timestamp as raw text
status_textVARCHAR(20)Transaction status as raw text
ingested_atTIMESTAMPTime the API record was loaded
customer_reference
ColumnTypeDescription
customer_idPKVARCHAR(20)Verified customer identifier
customer_nameVARCHAR(100)Canonical customer name
Tablesraw_api_transactionscustomer_reference
Interviewer

Your question is Download, Clean, and Transform Data with Pandas. Start with the requirements and the two tables 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.