Closed
Description
Running the following snippet on pandas version 0.10.1 leads the traceback at the bottom:
import numpy as np
import pandas as pd
from pandas import *
prng = period_range('1/1/2011', '1/1/2012', freq='M')
ts = Series(np.random.randn(len(prng)), prng)
ts.save('pd_save')
new_ts = pd.load('pd_save')
print new_ts
ValueError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)
169 else:
170 filename = fname
--> 171 exec compile(scripttext, filename, 'exec') in glob, loc
172 else:
173 def execfile(fname, *where):
C:\development\eclipse-workspace_23\slquant-dev\src\pd_bug.py in <module>()
8 ts.save('pd_save')
9 new_ts = pd.load('pd_save')
---> 10 print new_ts
C:\Python27\lib\site-packages\pandas\core\series.pyc in __str__(self)
968 if py3compat.PY3:
969 return self.__unicode__()
--> 970 return self.__bytes__()
971
972 def __bytes__(self):
C:\Python27\lib\site-packages\pandas\core\series.pyc in __bytes__(self)
978 """
979 encoding = com.get_option("display.encoding")
--> 980 return self.__unicode__().encode(encoding, 'replace')
981
982 def __unicode__(self):
C:\Python27\lib\site-packages\pandas\core\series.pyc in __unicode__(self)
994 result = self._get_repr(print_header=True,
995 length=len(self) > 50,
--> 996 name=True)
997 else:
998 result = com.pprint_thing(self)
C:\Python27\lib\site-packages\pandas\core\series.pyc in _get_repr(self, name, print_header, length, na_rep, float_format)
1080 length=length, na_rep=na_rep,
1081 float_format=float_format)
-> 1082 result = formatter.to_string()
1083 assert type(result) == unicode
1084 return result
C:\Python27\lib\site-packages\pandas\core\format.pyc in to_string(self)
124 return u''
125
--> 126 fmt_index, have_header = self._get_formatted_index()
127 fmt_values = self._get_formatted_values()
128
C:\Python27\lib\site-packages\pandas\core\format.pyc in _get_formatted_index(self)
110 else:
111 have_header = index.name is not None
--> 112 fmt_index = index.format(name=True)
113 return fmt_index, have_header
114
C:\Python27\lib\site-packages\pandas\tseries\period.pyc in format(self, name, formatter)
1006 header.append(str(self.name) if self.name is not None else '')
1007
-> 1008 return header + ['%s' % Period(x, freq=self.freq) for x in self]
1009
1010 def __array_finalize__(self, obj):
C:\Python27\lib\site-packages\pandas\tseries\period.pyc in __iter__(self)
683 def __iter__(self):
684 for val in self.values:
--> 685 yield Period(ordinal=val, freq=self.freq)
686
687 @property
C:\Python27\lib\site-packages\pandas\tseries\period.pyc in __init__(self, value, freq, ordinal, year, month, quarter, day, hour, minute, second)
79 raise ValueError("Ordinal must be an integer")
80 if freq is None:
---> 81 raise ValueError('Must supply freq for ordinal value')
82 self.ordinal = ordinal
83
ValueError: Must supply freq for ordinal value