[Tutor] genfromtxt vs. reading csv to a list or dictionary
esawiek at gmail.com
Sun Feb 7 20:36:06 EST 2016
I normally need to convert csv and text files to a Numpy array. I tried to
do the same thing using (1) reader=DictReader(MyFile), (2)
reader=csv.readre(MyFile), or (3) genfromtxt (MyFile ,……). The first two
is after I open the file. They produce a list of lists, list of tuples or
list of dictionaries which later are converted to an array.
The question is which one is the fastest and/or most efficient most
flexible? The genformtext function is nice b/c you can setup formatting of
various column which I often need to do b/c my files contain both string
and numeric values (integer and float).
Thanks in advance--EKE
More information about the Tutor