Series.unstack(level=-1, fill_value=None)
[source]
Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame. The level involved will automatically get sorted.
Parameters: |
level : int, string, or list of these, default last level Level(s) to unstack, can pass level name fill_value : replace NaN with this value if the unstack produces missing values |
---|---|
Returns: |
unstacked : DataFrame |
>>> s one a 1. one b 2. two a 3. two b 4.
>>> s.unstack(level=-1) a b one 1. 2. two 3. 4.
>>> s.unstack(level=0) one two a 1. 2. b 3. 4.
© 2011–2012 Lambda Foundry, Inc. and PyData Development Team
© 2008–2011 AQR Capital Management, LLC
© 2008–2014 the pandas development team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.19.2/generated/pandas.Series.unstack.html