Dataframe BenchMEASURED IN ONE ENVIRONMENT

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

    pandas to_csv is ~57.37× slower than polars write_csv for writing a CSV

    The largest ratio on this site. Both write the same 400,000-row file to the same directory.

    Result

    Runpandas to_csvpolars write_csvRatio
    Run 11293.3622.9456.38×
    Run 21315.0222.7257.88×
    Run 31294.4522.5657.37×

    Spread over 3 runs: pandas to_csv CV 0.9% / polars write_csv CV 0.8% / ratio CV 1.3%

    The two calls

    df.to_csv(out, index=False)
    df.write_csv(out)

    Conditions

    Same frame in both libraries, written to a temp file on the same SSD.

    Where this number does not apply

    This includes formatting every value to text; it is not a statement about disk speed.

    Reproduce

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