Closed
Description
Test program below:
import datetime, pytz, pandas
pandas.show_versions()
dates = [datetime.datetime(2014,1,1,1,1, tzinfo=pytz.utc),
datetime.datetime(2014,2,2,2,2, tzinfo=pytz.utc),
datetime.datetime(2014,3,3,3,3, tzinfo=pytz.utc)]
s = pandas.Series(dates)
s.to_pickle('series.pickle')
# import pickle
# with open('series.pickle', 'rb') as f: s1 = pickle.load(f)
s2 = pandas.read_pickle('series.pickle')
crashes at the last line with long stack trace. If replace "pytz.utc" by "datetime.timezone.utc", error disappears. Commented code fragment works properly in both cases.
INSTALLED VERSIONS
------------------
commit: None
python: 3.4.0.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.13.1
Cython: None
numpy: 1.8.1
scipy: 0.13.3
statsmodels: 0.5.0
IPython: None
sphinx: 1.2.2
patsy: 0.2.1
scikits.timeseries: None
dateutil: 2.2
pytz: 2014.2
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
sqlalchemy: 0.9.4
lxml: 3.3.4
bs4: 4.3.2
html5lib: 0.999
bq: None
apiclient: None
Traceback (most recent call last):
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 43, in try_read
return pc.load(fh, encoding=encoding, compat=False)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 89, in load
return up.load()
File "C:\Program Files\Python34\lib\pickle.py", line 1036, in load
dispatch[key[0]](self)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 18, in load_reduce
if type(args[0]) is type:
IndexError: tuple index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 49, in read_pickle
return try_read(path)
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 46, in try_read
return pc.load(fh, encoding=encoding, compat=True)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 89, in load
return up.load()
File "C:\Program Files\Python34\lib\pickle.py", line 1036, in load
dispatch[key[0]](self)
File "C:\Program Files\Python34\lib\pickle.py", line 1316, in load_newobj_ex
obj = cls.__new__(cls, *args, **kwargs)
TypeError: Required argument 'shape' (pos 1) not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 43, in try_read
return pc.load(fh, encoding=encoding, compat=False)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 89, in load
return up.load()
File "C:\Program Files\Python34\lib\pickle.py", line 1036, in load
dispatch[key[0]](self)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 18, in load_reduce
if type(args[0]) is type:
IndexError: tuple index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "H:/My Documents/PyCharm/LFDM/CalcFlowRate/tpicle.py", line 17, in <module>
s2 = pandas.read_pickle('series.pickle')
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 52, in read_pickle
return try_read(path, encoding='latin1')
File "C:\Program Files\Python34\lib\site-packages\pandas\io\pickle.py", line 46, in try_read
return pc.load(fh, encoding=encoding, compat=True)
File "C:\Program Files\Python34\lib\site-packages\pandas\compat\pickle_compat.py", line 89, in load
return up.load()
File "C:\Program Files\Python34\lib\pickle.py", line 1036, in load
dispatch[key[0]](self)
File "C:\Program Files\Python34\lib\pickle.py", line 1316, in load_newobj_ex
obj = cls.__new__(cls, *args, **kwargs)
TypeError: Required argument 'shape' (pos 1) not found
Process finished with exit code 1
Best regards,
Andrew