Closed
Description
Here is the code:
import pandas as pd
idx1 = pd.PeriodIndex(["2013-01", "2013-01", "2013-02", "2013-02"], freq="M")
idx2 = ["a","b","a","b"]
value = [1,2,3,4]
idx = pd.MultiIndex.from_arrays([idx1, idx2])
s = pd.Series(value, index=idx)
s.unstack()
It will raise following exception:
anaconda/lib/python2.7/site-packages/pandas-0.12.0.dev_424e187-py2.7-linux-x86_64.egg/pandas/tseries/period.pyc in _from_arraylike(cls, data, freq, tz)
649
650 if freq is None:
--> 651 raise ValueError(('freq not specified and cannot be '
652 'inferred from first element'))
653
ValueError: freq not specified and cannot be inferred from first element