Dataframe BenchMEASURED IN ONE ENVIRONMENT

    ↑↓ to select, Enter to open, Esc to close

    pandas drop_duplicates is ~1.77× slower than polars unique for removing duplicate key pairs

    Two integer columns, 400,000 rows, many duplicates.

    Result

    Runpandas drop_duplicatespolars uniqueRatio
    Run 132.9218.581.77×
    Run 231.8619.041.67×
    Run 346.3425.761.80×

    Spread over 3 runs: pandas drop_duplicates CV 21.8% / polars unique CV 19.0% / ratio CV 3.8%

    The two calls

    df[['g','k']].drop_duplicates()
    df.select(['g','k']).unique()

    Conditions

    Only the two key columns are materialised on both sides.

    Where this number does not apply

    Keeping the first/last row (`keep=`) adds work that is not timed here.

    Reproduce

    cd bench && python run.py --run 1 --out ../data/run1.json