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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
SQL Missing Values Count
00:00
5 left

SQL Missing Values Count

EasyPython

Problem

For a BCG X analytics workflow, records may contain incomplete values before they are processed. Given a collection of row records and a target column name, return how many rows have a missing value in that column.

Treat a value as missing when the column is absent from a row or its value is None. Do not treat valid values such as 0, False, or an empty string as missing.

Formal Specification

Implement count_missing_values(rows, column):

  • rows is a list of dictionaries, where each dictionary represents one record.
  • column is a string naming the column to inspect.
  • Return an integer equal to the number of rows where column is absent or mapped to None.
  • The input list and its dictionaries must not be modified.

Constraints

  • 0 <= len(rows) <= 10^5
  • Each row contains string keys and arbitrary values
  • column is a non-empty string
  • The function must inspect each row at most once

Function Signature

def count_missing_values(rows, column):
Interviewer

Your question is SQL Missing Values Count. 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.