You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.18.1.txt
+42-1
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,47 @@ API changes
138
138
- Provide a proper ``__name__`` and ``__qualname__`` attributes for generic functions (:issue:`12021`)
139
139
- ``pd.concat(ignore_index=True)`` now uses ``RangeIndex`` as default (:issue:`12695`)
140
140
141
+
.. _whatsnew_0181.enhancements.groubynth:
142
+
143
+
Index in ``Groupby.nth`` output is now more consistent with ``as_index``
144
+
argument passed in (:issue:`11039`):
145
+
146
+
Previous Behavior:
147
+
148
+
.. code-block:: ipython
149
+
150
+
In [4]: df
151
+
Out[4]:
152
+
A B
153
+
0 a 1
154
+
1 b 2
155
+
2 a 3
156
+
157
+
In [5]: df.groupby('A', as_index=True)['B'].nth(0)
158
+
Out[5]:
159
+
0 1
160
+
1 2
161
+
Name: B, dtype: int64
162
+
163
+
164
+
New Behavior:
165
+
166
+
.. code-block:: ipython
167
+
168
+
In [7]: df.groupby('A', as_index=True)['B'].nth(0)
169
+
Out[7]:
170
+
A
171
+
a 1
172
+
b 2
173
+
Name: B, dtype: int64
174
+
175
+
In [8]: df.groupby('A', as_index=False)['B'].nth(0)
176
+
Out[8]:
177
+
0 1
178
+
1 2
179
+
Name: B, dtype: int64
180
+
181
+
141
182
.. _whatsnew_0181.apply_resample:
142
183
143
184
Using ``.apply`` on groupby resampling
@@ -239,7 +280,7 @@ Deprecations
239
280
240
281
Performance Improvements
241
282
~~~~~~~~~~~~~~~~~~~~~~~~
242
-
283
+
- Performance improvements in ``GroupBy.cumcount`` (:issue:`11039`)
243
284
244
285
245
286
- Improved performance of ``DataFrame.to_sql`` when checking case sensitivity for tables. Now only checks if table has been created correctly when table name is not lower case. (:issue:`12876`)
0 commit comments