Skip to content

Commit da61c6b

Browse files
committed
some small corrections to clarify further
1 parent 28a7451 commit da61c6b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pandas/core/series.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,13 +1816,14 @@ def _set_name(
18161816
Parrot 20.0
18171817
Name: Max Speed, dtype: float64
18181818
1819-
We can pass a list of values (Here: ["a", "b", "a", "b"]) to group the Series data by custom labels:
1819+
We can pass a list of values (Here: ["a", "b", "a", "b"]) to
1820+
group the Series data by custom labels:
18201821
>>> ser.groupby(["a", "b", "a", "b"]).mean()
18211822
a 210.0
18221823
b 185.0
18231824
Name: Max Speed, dtype: float64
18241825
1825-
Grouping by numeric labels yields similar results: (Here: [0, 1, 0, 1]):
1826+
Grouping by numeric labels yields similar results (Here: [0, 1, 0, 1]):
18261827
>>> ser.groupby([0, 1, 0, 1]).mean()
18271828
0 210.0
18281829
1 185.0
@@ -1866,7 +1867,8 @@ def _set_name(
18661867
Parrot 25.0
18671868
Name: Max Speed, dtype: float64
18681869
1869-
We can also group by the 'Type' level of the hierarchical index to get the mean speed for each type:
1870+
We can also group by the 'Type' level of the hierarchical index
1871+
to get the mean speed for each type:
18701872
18711873
>>> ser.groupby(level="Type").mean()
18721874
Type
@@ -1890,7 +1892,9 @@ def _set_name(
18901892
NaN 3
18911893
dtype: int64
18921894
1893-
We can also group by a custom list (Here: ["a", "b", "a", np.nan]) with NaN values to handle missing group labels:
1895+
We can also group by a custom list with NaN values to handle
1896+
missing group labels (Here: ["a", "b", "a", np.nan]):
1897+
18941898
>>> arrays = ['Falcon', 'Falcon', 'Parrot', 'Parrot']
18951899
>>> ser = pd.Series([390., 350., 30., 20.], index=arrays, name="Max Speed")
18961900
>>> ser.groupby(["a", "b", "a", np.nan]).mean()

0 commit comments

Comments
 (0)