Skip to content

Commit 5e665b3

Browse files
Sudarshan Kongejorisvandenbossche
Sudarshan Konge
authored andcommitted
DOC: fix incorrect example in unstack docstring (GH14206) (#14211)
1 parent fb25cca commit 5e665b3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pandas/core/frame.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -3984,28 +3984,29 @@ def unstack(self, level=-1, fill_value=None):
39843984
... ('two', 'a'), ('two', 'b')])
39853985
>>> s = pd.Series(np.arange(1.0, 5.0), index=index)
39863986
>>> s
3987-
one a 1
3988-
b 2
3989-
two a 3
3990-
b 4
3987+
one a 1.0
3988+
b 2.0
3989+
two a 3.0
3990+
b 4.0
39913991
dtype: float64
39923992
39933993
>>> s.unstack(level=-1)
39943994
a b
3995-
one 1 2
3996-
two 3 4
3995+
one 1.0 2.0
3996+
two 3.0 4.0
39973997
39983998
>>> s.unstack(level=0)
39993999
one two
4000-
a 1 3
4001-
b 2 4
4000+
a 1.0 3.0
4001+
b 2.0 4.0
40024002
40034003
>>> df = s.unstack(level=0)
40044004
>>> df.unstack()
4005-
one a 1.
4006-
b 3.
4007-
two a 2.
4008-
b 4.
4005+
one a 1.0
4006+
b 2.0
4007+
two a 3.0
4008+
b 4.0
4009+
dtype: float64
40094010
40104011
Returns
40114012
-------

0 commit comments

Comments
 (0)