成功解决sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is amb

简介: 成功解决sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is amb

解决问题


F:\Program Files\Python\Python36\lib\site-packages\sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.

 if diff:




解决思路


错误地址:F:\Program Files\Python\Python36\lib\site-packages\sklearn\preprocessing\label.py:151

丢弃警告:空数组的真值不明确。返回false,但在将来这将导致错误。使用“array.size>0”检查数组是否为空。




解决方法


该问题是警告信息,不处理亦可运行程序,只需理解一下即可!空数组的真值不明确。返回false,但在将来这将导致错误。该库未来的升级ban版本中,需要采用“array.size>0”检查数组是否为空。


 


相关文章
|
11月前
|
Python
Sklearn|报错<Expected 2D array, got 1D array instead:...>的3种解决办法
Sklearn|报错<Expected 2D array, got 1D array instead:...>的3种解决办法
|
Python
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
399 0
成功解决ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
成功解决ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
成功解决ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
成功解决ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
成功解决preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous
成功解决preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous
|
2月前
|
JavaScript 前端开发
总结TypeScript 的一些知识点:TypeScript Array(数组)(下)
一个数组的元素可以是另外一个数组,这样就构成了多维数组(Multi-dimensional Array)。
|
2月前
|
存储 JavaScript 前端开发
总结TypeScript 的一些知识点:TypeScript Array(数组)(上)
数组对象是使用单独的变量名来存储一系列的值。
|
3月前
|
存储 安全 Swift
在Swift中,数组(Array)
在Swift中,数组(Array)
29 3
|
4月前
|
Ruby
|
6月前
|
存储 Java 索引
【面试题精讲】ArrayList 和 Array(数组)的区别?
【面试题精讲】ArrayList 和 Array(数组)的区别?