

Discover more from Daily Dose of Data Science
High-quality insights on Data Science and Python, along with best practices — shared daily.
Get a free 550+ page data science PDF guide and 450+ practice questions notebook.
Over 50,000 subscribers
Continue reading
Define the Correct DataType for Categorical Columns
If your data has categorical columns, you should not represent them as int/string data type.
Rather, Pandas provides an optimized data type specifically for categorical columns. This is especially handy when you are working with large data-driven projects.
The snippet compares the memory usage of string and categorical data types in Pandas.