[SciPy-User] timeseries tsfromtxt missing_values bug?

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Fri Jan 22 09:48:39 CST 2010


Is there any way to install the svn version on windows? This script is being primarily used on a windows box. If not I'll test on linux.

- dharhas

>>> Pierre GM <pgmdevlist@gmail.com> 1/20/2010 2:53 AM >>>
On Jan 15, 2010, at 3:11 PM, Dharhas Pothina wrote:
> Hi,
> 
> I'm having issues with tsfromtxt masking fields using the missing_values parameter.
> 
>>>> dateconverter = lambda y, m, d, hh, mm : datetime(year=int(y), month=int(m), day=int(d), hour=int(hh), minute=int(mm))
>>>> rseries = ts.tsfromtxt('test.csv',freq='T',comments='#',dateconverter=dateconverter,datecols=(1,2,3,4,5),usecols=(1,2,3,4,5,8),delimiter=',',missing_values=-999.0)
> 
> gives :
> 
> timeseries([(-999.0,) (-999.0,) (-999.0,)],
>   dtype = [('f5', '<f8')],
>   dates = [02-May-2000 06:00 12-May-2000 08:00 13-May-2000 00:00],
>   freq  = T)
> 
> While :
> 
>>>> rseries = ts.tsfromtxt('test.csv',freq='T',comments='#',dateconverter=dateconverter,datecols=(1,2,3,4,5),usecols=(1,2,3,4,5,8),delimiter=',',missing_values=-999.0,names='data')
> 
> gives :
> 
> timeseries([(--,) (--,) (--,)],
>   dtype = [('_tmp4', '<f8')],
>   dates = [02-May-2000 06:00 12-May-2000 08:00 13-May-2000 00:00],
>   freq  = T)
> 
> So if I uses the 'names' argument the missing values are masked  correctly but the field name is set to '_tmp4' rather than 'data'. If I don't use the 'names' argument the missing values are not masked. I've attached a small file to demonstrate. Am I doing something wrong or is this a bug.
> 


Dharhas,
Sorry for the delay. So yes, you uncovered two bugs: (1) when no names were given, the missing values were skipped (if they were not strings); (2) when using usecols, the names were properly propagated. 
I fixed them on SVN, would you mind giving a try ?
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org 
http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list