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

Run your code to see results

⌘↵ runs against the visible tests

Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.