Type inference assigns column types from loaded values and context. In pandas, failed inference can promote integers or other compact values to object or float64, expanding a 566 MB text file into a 2 GB DataFrame. section 7.1.2
Use memory evidence to validate inferred types and correct columns explicitly:
- Inspect deep memory usage and per-column unique-value counts before changing dtypes. section 7.1.2
- Convert date-time strings with pd.to_datetime; each example column falls from 464 MB to 48 MB. section 7.1.2
- Choose compact numeric representations when value ranges permit them, such as int8 for payment_type. section 7.1.2
Repairing an inferred payment type
Replace missing values before converting payment_type to np.int8; this column has only six numeric values but was inferred as float64.















