pandas-11 TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely错误解决方法

将一个list矩阵转化为numpy数组之后,使用np.isnan()方法,报出了这么一个错误:

TypeError: ufunc ‘isnan’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ‘‘safe’’

经过测试,发现是二维list转化为numpy数组的时候就存在问题了。
出错原因是list第二维的元素个数不一致导致如:
list1 = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9, 10]]
这时候使用 np.array(list1),输出如下内容:
[
list(1, 2, 3),
list(4, 5, 6),
list(7, 8, 9, 10)]
接着使用np.isnan()方法,就会报出最上面的错误。
因为第三行是4个元素,所以无法转化为我们想要的numpy数组,解决方法就是将列数改为一致即可。

最新文章

  1. [LeetCode] Best Time to Buy and Sell Stock II
  2. 国内外前端(js)开发框架对比
  3. OpenCascade Tcl vs. ACIS Scheme
  4. Mysql --分区表(1)
  5. React-router 要点
  6. Kooboo中怎么新增一个关联的Details 动态页面。
  7. 换成gnome3桌面后国际版qq不能输入中文问题
  8. 【CEOI2004】锯木厂选址
  9. Android--------Java接口回调
  10. 关于” fatal error C1010: unexpected end of file while looking forprecompiled header directive”问题
  11. Oracle100w数据大表割接
  12. markdown笔记实现页内目录跳转
  13. mysql批量更新数据
  14. 前端AES解密
  15. javascript中的 return false和return true
  16. Educational Codeforces Round 2 E - Lomsat gelral
  17. f5 Seldom used
  18. dede的织梦问答模块也可以支持arclist标签
  19. springmvc使用list集合实现商品列表的批量修改
  20. lsmod命令详解

热门文章

  1. PHP系列 | PHPexcel导入xls格式 ,提示错误:iconv(): Wrong charset, conversion from `CP936' to `UTF-8' is not allowed
  2. Comparable接口的使用
  3. 2019年MTP管理技能提升培训笔记
  4. 求解未知数——yjy题库
  5. nginx 安装 ssl 证书
  6. 小于K的两数之和
  7. Web API之Web Components
  8. linux 资源
  9. haproxy转发真实IP给web
  10. 打包工具Gradle