Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

I got `usecols` to select a subset and avoid this error problem

$
0
0

I load a .txt file into variable and reshape it, However, I got ValueError: the number of columns changed from 5 to 4 at row 205; use `usecols` to select a subset and avoid this error, How can I fix it?

My Code

from numpy import loadtxtdata = np.loadtxt('dense128.txt')data_2d = data.reshape(128, 1024)

My data

-0.04437835    0.2683646    -0.04066011   -0.05485807    0.07532401  -0.051052462   0.007219632  -0.014079349  -0.04061449   -0.008055394   0.07079242    0.031491395  -0.058560893   0.005037322   0.025653442   0.09527966    0.029884877  -0.0044821487  0.08880435    0.10437595   .....  -0.07650192   -0.05914555   -0.034037612  -0.2246162     0.19326839  -0.3463315    -0.26035556    0.04528108   -0.19029921   -0.102362975   0.21399875    0.000607502  -0.25709382    0.07336428  

Viewing all articles
Browse latest Browse all 14215

Trending Articles