Loading tutorials
DataFrame.memory_usage() and DataFrame.info(). Both can report numbers that are too low unless you ask for them carefully. This chapter explains what each tool counts, why the default answer c7 min readint64, float64 and object, and you have used memory_usage(deep=True) from the earlier chapters. It also assumes you know what the fixed-width integer dtypes hold. You will use `pd.to_numeric(..., downc5 min readfloat64 column uses 8 bytes per value. A float32 column uses 4 bytes per value and holds fewer significant digits. This chapter explains what that trade costs, how pd.to_numeric(..., downcast="float") behaves, and5 min readmemory_usage(deep=True) from the earlier chapter on measuring memory, and that you know what int64, float64 and object mean. The g6 min readcategory dtype. It assumes you can create and index DataFrames, know the basic dtypes (int64, float64, object), and have measured memory with memory_usage(deep=True).6 min readmemory_usage(deep=True) and that you know why an object column of strings is expensive. It also assumes you can convert a column with astype("category"). The question here is which string columns to convert and which to leave alone.7 min readcategory and measured the savings. This chapter explains why that works. It covers the two arrays that make up a categorical column, how the integer codes are chosen, and which operations touch only the small array and which touch every r6 min readcategory dtype can cut memory sharply, but it changes how a column behaves. Code that worked on strings can fail, return different results, or quietly use more memory than before. This chapter covers the failures you are most likely to meet and how to fix each one.6 min readpd.to_numeric and convert strings to category. It covers how to confirm that the smaller DataFrame still holds the same data, and which later operations can break values that looked fine.5 min readpd.read_csv, know int64, float64, object and category, and have seen memory_usage(deep=True) and `pd.to_numeric(..., downca6 min readmemory_usage(deep=True), integer and float downcasting, and the category dtype. You should be comfortable with pd.to_numeric, select_dtypes, and astype. Here you combine those steps into one function you can r6 min read