How to Solve sys:1: DtypeWarning: Columns (39,41,42,217) have mixed types.Specify dtype option on import or s

Successfully solved sys:1 : DtypeWarning: Columns (39,41,42,217) have mixed types.Specify dtype option on import or set low_ memory=False.

 


Problem solving

sys:1 : DtypeWarning: Columns (39,41,42,217) have mixed types.Specify dtype option on import or set low_ memory=False.

Solutions

sys:1 : dtype warning: columns (39, 41, 42217) have mixed types

Solutions

Because when pandas library reads the CSV file, because it involves the difference of memory of different computer hardware, it reads by block by default, not all of them are read at one time. Then, when pandas reads different blocks, if the data types in a field are not consistent, this warning will appear

The
pd.read_ CSV (test001. CSV ‘)
is changed to
PD. Read_ csv(test001.csv’, low_ memory=False)

Done!

Similar Posts: