Data Analyst Coding Interview Questions

Review this list of 26 coding data analyst interview questions and answers verified by hiring managers and candidates.
  • +3

    "Hi, my solution gives the exact numerical values as the proposed solution, but it doesn't pass the tests. Am I missing something, or is this a bug? def findrevenueby_city(transactions: pd.DataFrame, users: pd.DataFrame, exchange_rate: pd.DataFrame) -> pd.DataFrame: gets user city for each user id userids = users[['id', 'usercity']] and merge on transactions transactions = transactions.merge(user_ids, how='left"

    Gabriel P. - "Hi, my solution gives the exact numerical values as the proposed solution, but it doesn't pass the tests. Am I missing something, or is this a bug? def findrevenueby_city(transactions: pd.DataFrame, users: pd.DataFrame, exchange_rate: pd.DataFrame) -> pd.DataFrame: gets user city for each user id userids = users[['id', 'usercity']] and merge on transactions transactions = transactions.merge(user_ids, how='left"See full answer

    Data Analyst
    Coding
    +1 more
  • +1

    "Schema is wrong - id from product is mapped to id from transactions, id from product should point to product_id in transcations table"

    Arshad P. - "Schema is wrong - id from product is mapped to id from transactions, id from product should point to product_id in transcations table"See full answer

    Data Analyst
    Coding
    +1 more
  • +1

    "SELECT upsellcampaignid, COUNT(DISTINCT trans.userid) AS eligibleusers FROM campaign JOIN "transaction" AS trans ON transactiondate BETWEEN datestart AND date_end JOIN user ON trans.userid = user.userid WHERE iseligibleforupsellcampaign = 1 GROUP BY upsellcampaignid `"

    Alina G. - "SELECT upsellcampaignid, COUNT(DISTINCT trans.userid) AS eligibleusers FROM campaign JOIN "transaction" AS trans ON transactiondate BETWEEN datestart AND date_end JOIN user ON trans.userid = user.userid WHERE iseligibleforupsellcampaign = 1 GROUP BY upsellcampaignid `"See full answer

    Data Analyst
    Coding
    +3 more
  • +1

    "with cte as ( select c.firstname, c.lastname, t.receipt_number, count(t.receiptnumber) over(partition by c.customerid) as noofoffences from customers c join transactions t on c.customerid = t.customerid where t.receipt_number like '%999%' or t.receipt_number like '%1234%' or t.receipt_number like'%XYZ%') select * from cte where noofoffences>=2 `"

    Gowtami K. - "with cte as ( select c.firstname, c.lastname, t.receipt_number, count(t.receiptnumber) over(partition by c.customerid) as noofoffences from customers c join transactions t on c.customerid = t.customerid where t.receipt_number like '%999%' or t.receipt_number like '%1234%' or t.receipt_number like'%XYZ%') select * from cte where noofoffences>=2 `"See full answer

    Data Analyst
    Coding
    +3 more
  • " debug your code below departments = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'name': ['Reporting', 'Engineering', 'Marketing', 'Biz Dev', 'Silly Walks'] }) employees = pd.DataFrame({ 'id': [1, 2, 3, 4, 5, 6], 'first_name': ['John', 'Ava', 'Cailin', 'Mike', 'Ian', 'John'], 'last_name': ['Smith', 'Muffinson', 'Ninson', 'Peterson', 'Peterson', 'Mills'], 'salary': [20000, 10000, 30000, 20000, 80000, 50000], 'department_id': [1, 5, 2, 2, 2, 3] }) projects = p"

    Sean L. - " debug your code below departments = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'name': ['Reporting', 'Engineering', 'Marketing', 'Biz Dev', 'Silly Walks'] }) employees = pd.DataFrame({ 'id': [1, 2, 3, 4, 5, 6], 'first_name': ['John', 'Ava', 'Cailin', 'Mike', 'Ian', 'John'], 'last_name': ['Smith', 'Muffinson', 'Ninson', 'Peterson', 'Peterson', 'Mills'], 'salary': [20000, 10000, 30000, 20000, 80000, 50000], 'department_id': [1, 5, 2, 2, 2, 3] }) projects = p"See full answer

    Data Analyst
    Coding
    +1 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Data Analyst
    Coding
    +1 more
Showing 21-26 of 26