[SciPy-User] scikits.timeseries on windows: invalid object used in slice

Christoph Gohlke cgohlke at uci.edu
Sat Apr 2 14:36:00 EDT 2011



On 4/2/2011 10:33 AM, Skipper Seabold wrote:
> Any idea what's going on here? Code works fine on Linux with the same
> version. But on Windows 7, 64-bit with the binaries from Chrisoph
> <http://www.lfd.uci.edu/~gohlke/pythonlibs/>, I get the following
>
> In [1]: import scikits.timeseries as ts
>
> In [2]: s = """1947-01-01,21.700
>     ...: 1947-04-01,22.010
>     ...: 1947-07-01,22.490"""
>
> In [3]: from StringIO import StringIO
>
> In [4]: cpi = ts.tsfromtxt(StringIO(s), delimiter=",", freq="Q", datecols=(0),
>     ...:                         dtype=float)
>
> In [5]: cpi
> Out[5]:
> timeseries([21.7 22.01 22.49],
>     dates = [1947Q1 ... 1947Q3],
>     freq  = Q-DEC)
>
>
> In [6]: cpi[1:]
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
>
> C:\school\seaboldsvn\projects\greatinfl\<ipython console>  in<module>()
>
> C:\Python27\lib\site-packages\numpy\ma\core.pyc in __getslice__(self, i, j)
>     3060
>     3061         """
> ->  3062         return self.__getitem__(slice(i, j))
>     3063
>     3064     def __setslice__(self, i, j, value):
>
> C:\Python27\lib\site-packages\scikits\timeseries\tseries.pyc in __getitem__(self
> , indx)
>      650     Returns the item described by i. Not a copy.
>      651         """
> -->  652         (sindx, dindx, recheck) = self._index_checker(indx)
>      653         _data = ndarray.__getattribute__(self, '_data')
>      654         _mask = ndarray.__getattribute__(self, '_mask')
>
> C:\Python27\lib\site-packages\scikits\timeseries\tseries.pyc in _index_checker(s
> elf, indx)
>      613         if isinstance(indx, slice):
>      614             indx = slice(self._slicebound_checker(indx.start),
> -->  615                          self._slicebound_checker(indx.stop),
>      616                          indx.step)
>      617             return (indx, indx, False)
>
> C:\Python27\lib\site-packages\scikits\timeseries\tseries.pyc in _slicebound_chec
> ker(self, bound)
>      636         if not isinstance(bound, Date):
>      637             raise ValueError(
> -->  638                 "invalid object used in slice: %s" % repr(bound))
>      639         if bound.freq != _dates.freq:
>      640             raise TimeSeriesCompatibilityError('freq',
>
> ValueError: invalid object used in slice: 9223372036854775807L
>
> Cheers,
>
> Skipper


Your code works for me on win-amd64-py2.x but several timeseries 
selftests fail with this error. Maybe it has to do with timeseries 
internally storing 'absdates' as C type long, not ssize_t.

Christoph




More information about the SciPy-User mailing list