Aerospace Equipment Tracking
Snowflake ☯️ Medium Spark
Beginner Mode

Start your terminal to use beginner mode.

Objective

In this problem, you are analyzing tracking data within the aerospace industry. You are given two DataFrames: aerospace_df (containing information about various aerospace equipment) and company_df (containing information about the companies that own them).

Task

Join these two DataFrames so that you can create a comprehensive tracking report.

Create a new column called status_label that classifies the equipment based on the following rules:

  • If the status is "active" and the country is "USA", the status_label should be "Domestic Active".
  • If the status is "active" and the country is not "USA", the status_label should be "Foreign Active".
  • If the status is not "active", regardless of the country, the status_label should be "Inactive".

Rename the original columns to match the Expected Output Schema exactly, resolving any naming conflicts between the two tables. Save your resulting DataFrame as result_df. Order the final output by id in ascending order.

File Path

  • Aerospace Dataset: /home/interview/aerospace.csv
  • Company Dataset: /home/interview/company.csv
  • Starter script: /home/interview/aerospace_tracker.py

Schema

aerospace.csv

Column Name Data Type
id string
name string
type string
status string
company_id string

company.csv

Column Name Data Type
id string
name string
country string

Expected Output Schema

Column Name Data Type
id string
equipment_name string
equipment_type string
equipment_status string
company_name string
country string
status_label string

Example

Given this sample input:

aerospace_df

id name type status company_id
A1 Falcon 9 Rocket active C1
A2 Starship Rocket active C1
A3 Hubble Telescope active C2
A4 Galileo Satellite inactive C3
A5 Voyager 1 Probe active C3

company_df

id name country
C1 SpaceX USA
C2 NASA USA
C3 European Space Agency Europe

The expected output would be:

id equipment_name equipment_type equipment_status company_name country status_label
A1 Falcon 9 Rocket active SpaceX USA Domestic Active
A2 Starship Rocket active SpaceX USA Domestic Active
A3 Hubble Telescope active NASA USA Domestic Active
A4 Galileo Satellite inactive European Space Agency Europe Inactive
A5 Voyager 1 Probe active European Space Agency Europe Foreign Active

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →