Skip to content

Commit dea98f1

Browse files
author
Jon M. Mease
committed
Added note explaining version 0.20 change and ambiguity resolution / warning
1 parent 6a72cfa commit dea98f1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

doc/source/groupby.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,20 @@ The mapping can be specified many different ways:
9595
course ``df.groupby('A')`` is just syntactic sugar for
9696
``df.groupby(df['A'])``, but it makes life simpler
9797
- For DataFrame objects, a string indicating an index level to be used to group.
98-
If a string matches both an index level name and a column name then the column
99-
takes precedence
10098
- A list of any of the above things
10199

102100
Collectively we refer to the grouping objects as the **keys**. For example,
103101
consider the following DataFrame:
104102

103+
.. note::
104+
105+
.. versionadded:: 0.20
106+
107+
A string passed to ``groupby`` may refer to either a column or an index level.
108+
If a string matches both a column and an index level then a warning is issued
109+
and the column takes precedence. This will result in an ambiguity error in a
110+
future version.
111+
105112
.. ipython:: python
106113
107114
df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',

0 commit comments

Comments
 (0)