I have a csv
file with headers like:
Given this test.csv
file:
"A","B","C","D","E","F","timestamp"
611.88243,9089.5601,5133.0,864.07514,1715.37476,765.22777,1.291111964948
611.88243,9089.5601,5133.0,864.07514,1715.37476,765.22777,1.291113113366
611.88243,9089.5601,5133.0,864.07514,1715.37476,765.22777,1.291120650486
If, I use load.txt
then I get the array with 3 rows and 7 columns with exponential
values.
r1 = numpy.loadtxt(open("test.csv","rb"),delimiter=",",skiprows=1)
I get
[[ 6.11882430e+02 9.08956010e+03 5.13300000e+03 8.64075140e+02
1.71537476e+03 7.65227770e+02 1.29111196e+12]
[ 6.11882430e+02 9.08956010e+03 5.13300000e+03 8.64075140e+02
1.71537476e+03 7.65227770e+02 1.29111311e+12]
[ 6.11882430e+02 9.08956010e+03 5.13300000e+03 8.64075140e+02
1.71537476e+03 7.65227770e+02 1.29112065e+12]]
To avoid exponential
I used the following code but still it gives the same exponential values. My code to avoid exponential:
r1 = np.loadtxt(open("test.csv","rb"),delimiter=",", dtype=np.float64, skiprows=1)
Is there any way to remove the exponential
while creating the numpy matrix? I know I can remove the values later with numpy.savetxt(sys.stdout, r1, '%5.2f')
but I want it while creating the matrix not after creation.