成功解决sys:1: DtypeWarning: Columns (39,41,42,217) have mixed types.Specify dtype option on import or s

简介: 成功解决sys:1: DtypeWarning: Columns (39,41,42,217) have mixed types.Specify dtype option on import or s


目录

解决问题

解决思路

解决方法


 

 

 

 

 

解决问题

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

 

 

解决思路

sys:1: Dtype警告:列(39、41、42,217)有混合类型

 

 

解决方法

因为pandas库读取csv文件的时候,因为涉及到不同电脑硬件内存的差异,默认按块读取的,并非一次性全部读取完。那么,pandas在读取不同块的时候,如果某字段下的数据类型不尽一致,则会出现该警告。

 

pd.read_csv(test001.csv')

改为

pd.read_csv(test001.csv', low_memory=False)

 

 

哈哈,大功告成!

 

相关文章
|
7月前
|
编解码 算法 Python
ImportError: cannot import name ‘_update_worker_pids’ from ‘torch._C’
ImportError: cannot import name ‘_update_worker_pids’ from ‘torch._C’
96 0
|
Python
Python报错ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Python报错ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
1730 1
|
数据库
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
1224 0
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
|
7月前
|
Scala
【已解决】Specifying keys via field positions is only valid for tuple data types. Type: GenericType<scala
【已解决】Specifying keys via field positions is only valid for tuple data types. Type: GenericType<scala
72 0
pd.set_option()参数详解
pd.set_option()参数详解
195 0
|
TensorFlow 算法框架/工具
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
288 0
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
|
编解码 搜索推荐 算法
Data-Data Objects and Attribute Types| 学习笔记
快速学习 Data-Data Objects and Attribute Types。
Data-Data Objects and Attribute Types| 学习笔记
|
Python
You are trying to merge on object and int64 columns. If you wish to proceed you should use pd.conca
You are trying to merge on object and int64 columns. If you wish to proceed you should use pd.conca
797 0
|
算法框架/工具 Windows
|
Python