我有一个来自模拟的文件,其内容如下:
5.2000 -0.01047 -0.02721 0.823400 -0.56669 1.086e-5 2.109e-5 -1.57e-5 -3.12e-5
0.823400 -0.56669 -0.02166 -0.01949 -2.28e-5 -2.66e-5 1.435e-5 1.875e-5
1.086e-5 2.109e-5 -2.28e-5 -2.66e-5 -0.01878 -0.01836 0.820753 -0.57065
-1.57e-5 -3.12e-5 1.435e-5 1.875e-5 0.820753 -0.57065 -0.01066 -0.02402
5.2005 -0.01045 -0.02721 0.823354 -0.56676 1.086e-5 2.109e-5 -1.57e-5 -3.12e-5
0.823354 -0.56676 -0.02167 -0.01947 -2.28e-5 -2.66e-5 1.435e-5 1.875e-5
1.086e-5 2.109e-5 -2.28e-5 -2.66e-5 -0.01878 -0.01833 0.820703 -0.57073
-1.57e-5 -3.12e-5 1.435e-5 1.875e-5 0.820703 -0.57073 -0.01063 -0.02401
5.2010 -0.01043 -0.02721 0.823309 -0.56683 1.087e-5 2.108e-5 -1.57e-5 -3.12e-5
0.823309 -0.56683 -0.02168 -0.01945 -2.28e-5 -2.66e-5 1.435e-5 1.874e-5
1.087e-5 2.108e-5 -2.28e-5 -2.66e-5 -0.01878 -0.01830 0.820654 -0.57080
-1.57e-5 -3.12e-5 1.435e-5 1.874e-5 0.820654 -0.57080 -0.01061 -0.02400
我想把它作为一个浮点数+一个浮点数组(浮点数将是' 5.2000'以及后面的数组(4x8表) 但是numpy命令loadtxt并没有得到这种奇特的结构。有解决方案吗?
答案 0 :(得分:1)
如果"表"总是4x8那么它可能更容易以1D数组的形式读取数据,然后索引/重塑这个以获得你想要的输出:
root@kali:~/gpspoof/gnss-sdr/build# make
[ 1%] Performing build step for 'glog-0.3.4'
cd /root/gpspoof/gnss-sdr/thirdparty/glog/glog-0.3.4 && automake-1.14 --gnu
/bin/bash: line 4: automake-1.14: command not found
Makefile:928: recipe for target '/root/gpspoof/gnss-sdr/thirdparty/glog/glog-0.3.4/Makefile.in' failed
make[3]: *** [/root/gpspoof/gnss-sdr/thirdparty/glog/glog-0.3.4/Makefile.in] Error 1
CMakeFiles/glog-0.3.4.dir/build.make:111: recipe for target 'glog-0.3.4/src/glog-0.3.4-stamp/glog-0.3.4-build' failed
make[2]: *** [glog-0.3.4/src/glog-0.3.4-stamp/glog-0.3.4-build] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/glog-0.3.4.dir/all' failed
make[1]: *** [CMakeFiles/glog-0.3.4.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
答案 1 :(得分:0)
genfromtxt
通常比loadtxt