Ciao a tutti,
ho un file di testo su due colonne:
%GIORNO VALORE
150.9965278 -164781.423
150.9930556 -164781.035
150.9895833 -164780.714
150.9861111 -164780.419Siccome lo devo elaborare ho pensato di leggere il file con il seguente codice:
import numpy
dati=numpy.loadtxt(dir+nomefile)
doy=dati[:,0]
clk=dati[:,1]
però il programma mi restituisce il seguente errore:
C:\Python26\lib\site-packages\numpy\lib\io.py in loadtxt(fname=dir+nomefile, dtype=dtype('float64'), comments='#', delimiter=None, converters=[<type 'float'>, <type 'float'>], skiprows=0, usecols=None, unpack=False)
628
629 # Convert each value according to its column and store
630 X.append(tuple([conv(val) for (conv, val) in zip(converters, vals)]))
631 finally:
632 if isstring:
X = [], X.append = <built-in method append of list object>, builtin tuple = <type 'tuple'>, conv = <type 'float'>, val = '%GIORNO', builtin zip = <built-in function zip>, converters = [<type 'float'>, <type 'float'>], vals = ['%GIORNO', 'VALORE']
<type 'exceptions.ValueError'>: invalid literal for float(): %GIORNO
args = ('invalid literal for float(): %GIORNO',)
message = 'invalid literal for float(): %GIORNO'
Qualche idea?