I wrote a script to take the data files that are in the columns and put them in depending on which column wants to look. Well, I noticed that the plots look crazy and have all the wrong numbers, because python ignores exponential.
My numbers are in the format: 1.000000E + 1 OR 1.000000E-1
What is dtype? I am using numpy.genfromtxt to import with dtype = float. I know that there are all types of dtypes that you can enter, but I cannot find an exhaustive list of options and examples.
Thank.
Here is an example of my input (these spaces are tabs):
Time stamp T1_ModBt T2_90Bend T3_InPE T5_Stg2Rfrg
5:22 AM 2.115800E + 2 1.400000E + 0 1.400000E + 0 3.035100E + 1
5:23 AM 2.094300E + 2 1.400000E + 0 1.400000E + 0 3.034800E + 1
5:24 AM 2.079300E + 2 1.400000E + 0 1.400000E + 0 3.031300E + 1
5:25 AM 2.069500E + 2 1.400000E + 0 1.400000E + 0 3.031400E + 1
5:26 AM 2.052600E + 2 1.400000E + 0 1.400000E + 0 3.030400E + 1
5:27 AM 2.040700E + 21.400000E + 0 1.400000E + 0 3.029100E + 1
Update
I understood at least part of the reason why what I am doing is not working. Still don't know how to define dtypes the way I want.
import numpy as np
file = np.genfromtxt('myfile.txt', usecols = (0,1), dtype = (str, float), delimiter = '\t')
Returns an array of rows for each column. How can I say that I want column 0 to be str and all other columns to be floating?
source
share