[SciPy-user] timeseries.convert and structured arrays

Dave Hirschfeld dave.hirschfeld@gmail....
Wed Apr 29 09:10:28 CDT 2009


Hi,
I ran into a problem using the convert function with a structured array (see
below) so I just wanted to check if the timeseries function convert is intended
to support structured arrays? If not are there any plans to do so? And if it
does, what am I doing wrong below??

Thanks,
Dave

dates = ts.date_array(start_date=ts.Date('D','2008-01-01'),
                      end_date=ts.Date('D','2008-12-31'))
#

data = np.array(zip(np.random.rand(366),np.random.rand(366)),
                dtype=[('field1',np.float),('field2',np.object)])
#

data = ts.time_series(data,dates)
data.convert('M')



C:\dev\bin\Python25\lib\site-packages\scikits\timeseries\tseries.pyc in
convert(series, freq, func, position, *args, **kwargs)
   1999
   2000     if series.ndim == 1:
-> 2001         obj = _convert1d(series, freq, func, position, *args, **kwargs)
   2002     elif series.ndim == 2:
   2003         base = _convert1d(series[:,0], freq, func, position, *args,
**kwargs)

C:\dev\bin\Python25\lib\site-packages\scikits\timeseries\tseries.pyc in
_convert1d(series, freq, func, position, *args, **kwargs)
   1909
   1910     cdictresult = cseries.TS_convert(data_, from_freq, to_freq, position,
-> 1911                                      int(start_date), mask_)
   1912     start_date = Date(freq=to_freq, value=cdictresult['startindex'])
   1913     data_ = masked_array(cdictresult['values'], mask=cdictresult['mask'])

ValueError: data type must provide an itemsize





More information about the SciPy-user mailing list