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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4