Skip to content

Commit 83385d1

Browse files
committed
reverting changes
1 parent 8f6adec commit 83385d1

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

pandas/core/series.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,27 +1815,14 @@ def _set_name(
18151815
Parrot 30.0
18161816
Parrot 20.0
18171817
Name: Max Speed, dtype: float64
1818-
1819-
We can pass a list of values to
1820-
group the Series data by custom labels (Here: ["a", "b", "a", "b"]):
18211818
>>> ser.groupby(["a", "b", "a", "b"]).mean()
18221819
a 210.0
18231820
b 185.0
18241821
Name: Max Speed, dtype: float64
1825-
1826-
Grouping by numeric labels yields similar results (Here: [0, 1, 0, 1]):
1827-
>>> ser.groupby([0, 1, 0, 1]).mean()
1828-
0 210.0
1829-
1 185.0
1830-
Name: Max Speed, dtype: float64
1831-
1832-
We can group by a level of the index:
18331822
>>> ser.groupby(level=0).mean()
18341823
Falcon 370.0
18351824
Parrot 25.0
18361825
Name: Max Speed, dtype: float64
1837-
1838-
We can group by a condition applied to the Series values:
18391826
>>> ser.groupby(ser > 100).mean()
18401827
Max Speed
18411828
False 25.0
@@ -1858,16 +1845,11 @@ def _set_name(
18581845
Parrot Captive 30.0
18591846
Wild 20.0
18601847
Name: Max Speed, dtype: float64
1861-
18621848
>>> ser.groupby(level=0).mean()
18631849
Animal
18641850
Falcon 370.0
18651851
Parrot 25.0
18661852
Name: Max Speed, dtype: float64
1867-
1868-
We can also group by the 'Type' level of the hierarchical index
1869-
to get the mean speed for each type:
1870-
18711853
>>> ser.groupby(level="Type").mean()
18721854
Type
18731855
Captive 210.0
@@ -1883,16 +1865,12 @@ def _set_name(
18831865
b 3
18841866
dtype: int64
18851867
1886-
To include `NA` values in the group keys, set `dropna=False`:
18871868
>>> ser.groupby(level=0, dropna=False).sum()
18881869
a 3
18891870
b 3
18901871
NaN 3
18911872
dtype: int64
18921873
1893-
We can also group by a custom list with NaN values to handle
1894-
missing group labels (Here: ["a", "b", "a", np.nan]):
1895-
18961874
>>> arrays = ['Falcon', 'Falcon', 'Parrot', 'Parrot']
18971875
>>> ser = pd.Series([390., 350., 30., 20.], index=arrays, name="Max Speed")
18981876
>>> ser.groupby(["a", "b", "a", np.nan]).mean()

0 commit comments

Comments
 (0)