← All Python interview questions
Shrink a DataFrame's memory footprint
MediumPandas — CleaningAmazonWalmart
A 40-million-row extract will not fit in memory with default dtypes.
Write optimise(df) that returns a copy where integer columns are downcast to the smallest safe integer type, float columns to the smallest safe float type, and object columns with fewer than 50% unique values become category.
More Pandas — Cleaning questions
Practising alone only goes so far — our live cohorts pair Python and Pandas depth with dashboards, agentic analytics projects and mock interviews.
Explore the program