Dataframe BenchMEASURED IN ONE ENVIRONMENT

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

    pandas .values.tolist() is ~1.92× slower than polars .rows() for turning rows into Python objects

    Only 2,000 rows are converted, so this measures per-row overhead.

    Result

    Runpandas .values.tolist()polars .rows()Ratio
    Run 10.690.342.01×
    Run 20.650.341.92×
    Run 30.940.51.90×

    Spread over 3 runs: pandas .values.tolist() CV 20.6% / polars .rows() CV 22.8% / ratio CV 3.0%

    The two calls

    df[['g','v']].head(2000).values.tolist()
    df.select(['g','v']).head(2000).rows()

    Conditions

    The frame is already in memory.

    Where this number does not apply

    Converting the whole 400,000-row frame is dominated by allocation, not by per-row overhead.

    Reproduce

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