python - empty strings after genfromtxt numpy -
thanks patience, i'm pretty new python. input file tab-delimited table.
import numpy np #from stringio import stringio inputfile=raw_input('filepath please: ') fieldnames='reference position, type, length, reference, allele, linkage, zygosity, \ count, coverage, frequency, hyper-allelic, forward/reverse balance, average quality, \ overlapping annotations, coding part change, amino acid change' fieldtypes='int,str,int,str,str,str,str,int,int,float,str,float,float,str,str,str' open(inputfile) f: storage=np.genfromtxt(f, skip_header=1, delimiter='\t', names=fieldnames, dtype=fieldtypes) print storage
i valueerror: size of tuple must match number of fields.
help?
edit:
well, after implementing @wooble's suggestions, no more error…edit2:
but problem after print storage, cells of dtype str empty strings (''). why this?edit3: solved empty string problem changing str types above |s#, # integer.
but problem after print storage, cells of dtype str empty strings (''). why this?
edit3: solved empty string problem changing str types above |s#, # integer.
python string numpy
No comments:
Post a Comment