python - 使用 nupy genfromtxt, python 加载数据的问题
问题描述
我的文本文件 ( test.out
) 包含的数据排列为三行,但每行的列数不同。如下图所示
2013 531 1155 24.0 L 19.219 76.766 0.2 JOY 3 0.0 0.4LJOY 1
CBN SZ IPg 1155 26.58 87 0.0110 15.1 134
CBN SN ESg 1155 28.38 87 -0.0210 15.1 134
使用 import numpy as np 加载数据时显示错误
d1=np.genfromtxt('test.out', dtype=str)
它显示错误消息: raise ValueError(errmsg)
ValueError: Some errors were detected !
Line #2 (got 9 columns instead of 13)
Line #3 (got 9 columns instead of 13)
如何使用 numpy 加载它genfromtxt
。如果有人可以提供帮助,那对我来说将是很大的帮助。提前致谢。
解决方案
推荐阅读
- vue.js - 通过路由器链接传递道具
- docker - 安装期间清除缓存时 Slick 模块出错
- sql-server - 带有数组的 SQL Server 变量日期时间
- google-sheets-formula - 如果更改数组时满足各种条件,则标记行
- typo3 - 错字3中文件的持久性属性
- c# - 使用 c# 从文件中返回 json 属性名称
- java - 我可以采取什么步骤来修复“原始使用参数化类'Class'”的警告?
- java - 我不保存的实体上的 java.sql.SQLSyntaxErrorException
- docker - 如何排除 .dockerignore 中的 .go 文件以外的所有内容?
- javascript - 如何在javascript中将列表项的字符串值打印到控制台日志?