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
Transformations and KPIs with AI Tools
00:00
5 left

Transformations and KPIs with AI Tools

MediumPython

Problem

Given an existing code base, implement the data transformation code and generate the possible KPIs, using AI tools and explaining how you use them

Asked in the AI coding round stage. Full AI access; evaluation includes both the implementation and how effectively you use and verify AI assistance.

Implement transform_and_generate_kpis(records). Each record is a dictionary with timestamp as an ISO string, user_id, event, and numeric value. Return {"records": transformed_records, "kpis": kpis}. Add day from the first 10 timestamp characters and normalize event with trimming and lowercase. KPIs must include total events, unique users, total value, average value rounded to two decimals, counts by event, and counts by day.

Constraints

  • 0 <= len(records) <= 5000
  • Each record contains timestamp, user_id, event, and value
  • timestamp is a non-empty ISO-formatted string beginning with YYYY-MM-DD
  • event is a string and value is numeric
  • Preserve the input record order

Function Signature

def transform_and_generate_kpis(records):
Interviewer

Your question is Transformations and KPIs with AI Tools. Start with the requirements 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.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.