SpinTheMic
Pro

Interview practice question

pandas groupby too slow on 80 million rows

Data Engineering · Python · Intermediate

A pandas groupby on 80 million rows takes 40 minutes and uses most of the server's memory. What alternatives do you consider?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • pandas is single-threaded and memory heavy for this size.
  • Polars runs multi-threaded with lower memory.
  • DuckDB can run the same aggregation in SQL on Parquet.
  • Read only needed columns and use efficient dtypes.
  • Or push the aggregation down to the warehouse.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics