import pandas as pd import numpy as np data = ''' 1,2,3 4,5,6''' fileobj = pd.compat.StringIO(data) df = pd.read_csv(fileobj, dtype={0:'int8',1:'int8',2:'int32'}, header=None) print(df.dtypes)