Pandas Read CSV set dtype
When recognizing integers read_csv will default to int64, but if we would like to save memory we can set the dtype while we read the file.
examples/pandas/mixed_set_dtype.py
import pandas as pd import numpy as np df = pd.read_csv('mixed.csv', dtype = { 'MyInteger' : np.int8 }) print( df.dtypes )
MyText object MyInteger int8 MyFloat float64 MyBool bool MyExit int64 dtype: object