PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in data manipulation and transformation by mapping numeric score margins to categorical labels and implementing vectorized operations in pandas as well as idiomatic R data-frame workflows.

  • Medium
  • Atlassian
  • Data Manipulation (SQL/Python)
  • Data Scientist

Label game performance by margin

Company: Atlassian

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Given a games DataFrame (or R data.frame) with columns: team_id, opponent_team_id, team_score, opponent_team_score, write code to: (1) Define a function that maps margin = team_score - opponent_team_score to labels: 'Blowout Win' (margin >= 20), 'Close Win' (1–19), 'Tie' (0), 'Close Loss' (-1 to -19), 'Blowout Loss' (<= -20). (2) Apply it to create a new column performance_label for every row. Provide both: (a) a vectorized Python solution using pandas (no per-row Python loop), and (b) an idiomatic R solution using dplyr or base R. Validate with this tiny example: team_id,opponent_team_id,team_score,opponent_team_score -> (1,2,95,70) => Blowout Win; (1,3,82,85) => Close Loss; (2,1,93,93) => Tie.

Quick Answer: This question evaluates proficiency in data manipulation and transformation by mapping numeric score margins to categorical labels and implementing vectorized operations in pandas as well as idiomatic R data-frame workflows.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Rank each team’s top 3 scores in 2024 - Atlassian (Medium)
  • Find 2023 NCAA championship winner - Atlassian (Medium)
  • Identify Top-3 Users by Recent Total Spend - Atlassian (Medium)