[SciPy-User] How to specify the dtype in IO

nicky van foreest vanforeest@gmail....
Thu Apr 22 03:14:00 CDT 2010


Hi,

Have you tried the csv module? This is part of some code that I use:

    import csv
    reader =  csv.reader(open("dummy.csv"))
    for row in reader:
        Id = str(row[0])

Thus, you can determine the format of each column specifically.

bye

Nicky



On 21 April 2010 20:32, Leon Sit <wing1127aishi@gmail.com> wrote:
> Hi All
>
> I have a csv file with columns of the following dtype
>
> int8, int8, int8, float, float, ............
>
> and the column size is arbitrary. Is there a way to specific the dtype
> in genfromtxt() such that it knows the first three column is int and
> float otherwise?
>
> Thanks
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list