From 8247a64b146420cb77b65951db29c6c0ee908310 Mon Sep 17 00:00:00 2001 From: sudarshan Date: Tue, 13 Sep 2016 13:39:50 +0530 Subject: [PATCH 1/3] Doc fix for DataFrame.unstack() --- pandas/core/frame.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index de74b70cdfaac..33c52eefb68f3 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3805,29 +3805,30 @@ def unstack(self, level=-1): ... ('two', 'a'), ('two', 'b')]) >>> s = pd.Series(np.arange(1.0, 5.0), index=index) >>> s - one a 1 - b 2 - two a 3 - b 4 + one a 1.0 + b 2.0 + two a 3.0 + b 4.0 dtype: float64 >>> s.unstack(level=-1) a b - one 1 2 - two 3 4 + one 1.0 2.0 + two 3.0 4.0 >>> s.unstack(level=0) one two - a 1 3 - b 2 4 + a 1.0 3.0 + b 2.0 4.0 >>> df = s.unstack(level=0) >>> df.unstack() - one a 1. - b 3. - two a 2. - b 4. - + one a 1.0 + b 3.0 + two a 2.0 + b 4.0 + dtype: float64 + Returns ------- unstacked : DataFrame or Series From 26bf99fe54b0e0f0d287dbd861d405fc930aee80 Mon Sep 17 00:00:00 2001 From: sudarshan Date: Tue, 13 Sep 2016 15:43:41 +0530 Subject: [PATCH 2/3] Corrected the doc mistake. --- pandas/core/frame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 33c52eefb68f3..46a8b9c26d1fb 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3824,8 +3824,8 @@ def unstack(self, level=-1): >>> df = s.unstack(level=0) >>> df.unstack() one a 1.0 - b 3.0 - two a 2.0 + b 2.0 + two a 3.0 b 4.0 dtype: float64 From 99c2f0b6adf79571d235a1db48cb57b3884178d8 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 13 Sep 2016 23:50:21 +0200 Subject: [PATCH 3/3] fix whitespace --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 46a8b9c26d1fb..e46d4c6b928a9 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3828,7 +3828,7 @@ def unstack(self, level=-1): two a 3.0 b 4.0 dtype: float64 - + Returns ------- unstacked : DataFrame or Series