Clean a Price Column and Drop Duplicates
~12 mincode completion
Implement clean_listings(cities, prices). Build a DataFrame with columns "city" and "price", apply both steps, and return the cleaned price column as a list of floats.
Where this shows up
~12 min
••••••••••••••••
8 employers weight this skill
2 big tech firms, 2 frontier labs, 1 AI product company, 1 defense company, 1 enterprise vendor, 1 quant fund. Top match scores 63.
Python
import pandas as pd
def clean_listings(cities, prices):
"""
Convert a text price column to numbers, then drop duplicate rows.
Args:
cities: list of city names
prices: list of prices as text, like "$1,200" or " 950 "
Returns:
list of floats: the price column after cleaning, first copies kept
"""
# YOUR CODE HERE
pass