[SciPy-user] loadtxt error

Dharhas Pothina Dharhas.Pothina at twdb.state.tx.us
Wed Apr 23 10:54:54 EDT 2008


Ok it looks like I had a couple of rows with values missing in the third column. I didn't notice before since matlab and octave assumes zeros in those cases. Is there a function in numpy/scipy that can read files like that or should I fix the file before reading it in?

thanks for your help.

- dharhas

>>> Pauli Virtanen <pav at iki.fi> 4/23/2008 9:50 AM >>>
Wed, 23 Apr 2008 16:44:16 +0200, Nils Wagner wrote:

> On Wed, 23 Apr 2008 09:31:06 -0500
>   "Dharhas Pothina" <Dharhas.Pothina at twdb.state.tx.us>
> wrote:
[clip]
>> I have an ascii text file with the format :
>> 
>> year month sumprcp(in)
>> 1976 01 2.07
>> 1976 02 0.76
>> 1976 03 2.53
>> 1976 04 2.25
>> ...
>> 
>> When trying to read it with the function loadtxt() I am
>>getting an error :
>> in iPython I type :
>> 
>> from numpy import *
>> year,month,data =
>>loadtxt('portarthurcity_monthlyprecip.txt',skiprows=1,unpack=True)
>> 
>> I get the error :

No problem here either, with numpy 1.0.4. Is there garbage later on in 
the file?

-- 
Pauli Virtanen

_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org 
http://projects.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list