Pickling Time Series Data

25 views
Skip to first unread message

Chris Diehl

unread,
Oct 10, 2012, 2:29:55 PM10/10/12
to pyd...@googlegroups.com
Hi All, 

In my attempt to capture some time series data and share to report another problem I'm seeing, I discovered that I can't even pickle the data I want to disk. I'm out of ideas to try and so I thought I'd share what I'm seeing. Any suggestions most appreciated! 

I confirmed that I could successfully pickle a random time series that I created to disk and load it back into memory. Not sure what is so special about this particular one. 

I'm running Pandas 0.9 in an IPython notebook v0.13. 

Chris

In:
ts = consumption_percentiles[0]
ts.values
Out:
array([  0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   1.,   1.,   1.,
         1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,
         1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   2.,   2.,
         2.,   2.,   2.,   2.,   2.,   2.,   2.,   2.,   2.,   2.,   2.,
         2.,   2.,   2.,   3.,   3.,   3.,   3.,   3.,   3.,   3.,   3.,
         3.,   3.,   3.,   3.,   3.,   3.,   3.,   3.,   3.,   3.,   4.,
         4.,   4.,   4.,   4.,   4.,   4.,   4.,   4.,   4.,   4.,   4.,
         4.,   4.,   4.,   4.,   5.,   5.,   5.,   5.,   5.,   5.,   5.,
         5.,   5.,   5.,   5.,   5.,   5.,   6.,   6.,   6.,   6.,   6.,
         6.,   6.,   6.,   6.,   6.,   6.,   6.,   6.,   6.,   7.,   7.,
         7.,   7.,   7.,   7.,   7.,   7.,   7.,   8.,   8.,   8.,   8.,
         8.,   8.,   8.,   8.,   8.,   8.,   8.,   9.,   9.,   9.,   9.,
         9.,   9.,   9.,   9.,  10.,  10.,  10.,  10.,  10.,  10.,  10.,
        10.,  11.,  11.,  11.,  11.,  11.,  11.,  11.,  12.,  12.,  12.,
        12.,  12.,  12.,  12.,  12.,  13.,  13.,  13.,  13.,  13.,  13.,
        13.,  14.,  14.,  14.,  14.,  14.,  14.,  14.,  15.,  15.,  15.,
        15.,  15.,  15.,  15.,  16.,  16.,  16.,  16.,  16.,  16.,  16.,
        17.,  17.,  17.,  17.,  17.,  17.,  17.,  18.,  18.,  18.,  18.,
        18.,  18.,  19.,  19.,  19.,  19.,  19.,  19.,  20.,  20.,  20.,
        20.,  20.,  21.,  21.,  21.,  21.,  22.,  22.,  22.,  22.,  22.,
        22.,  23.,  23.,  23.,  23.,  23.,  24.,  24.,  24.,  25.,  25.,
        25.])

In:
ts.index
Out:
<class 'pandas.tseries.index.DatetimeIndex'>
[2011-08-08 00:00:00, ..., 2012-09-29 00:00:00]
Length: 419, Freq: None, Timezone: None

In:
ts.save('tstest')
ts2 = pandas.TimeSeries()
ts2.load('tstest')
ts2
Out:
Series([], dtype=float64)

Skipper Seabold

unread,
Oct 10, 2012, 2:34:40 PM10/10/12
to pyd...@googlegroups.com
AFAICT load returns an object. So

ts2 = ts2.load('tstest')

or

ts2 = pandas.load('tstest')

should work.

Skipper

Wouter Overmeire

unread,
Oct 10, 2012, 2:38:46 PM10/10/12
to pyd...@googlegroups.com


2012/10/10 Skipper Seabold <jsse...@gmail.com>

Skipper

--



works fine for me (pandas 0.9 / IPython 0.13 / numpy 1.6.1

In [14]: s.save('tmp.pickle')

In [15]: pd.load('tmp.pickle').values
Out[15]: 

Chris Diehl

unread,
Oct 12, 2012, 12:22:03 AM10/12/12
to pyd...@googlegroups.com
Ah ok. Thanks guys. I clearly expected the opposite behavior so didn't think to try that. 

Chris
Reply all
Reply to author
Forward
0 new messages