Skip to content

Commit cc4b0d4

Browse files
committed
Fix pre-commit.ci errors
1 parent b034bd1 commit cc4b0d4

File tree

4 files changed

+322
-288
lines changed

4 files changed

+322
-288
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ Groupby/resample/rolling
11501150
- Bug in :meth:`Rolling.apply` where the applied function could be called on fewer than ``min_period`` periods if ``method="table"``. (:issue:`58868`)
11511151
- Bug in :meth:`Series.resample` could raise when the date range ended shortly before a non-existent time. (:issue:`58380`)
11521152
- Bug in :meth:`Series.rolling.var` and :meth:`Series.rolling.std` where the end of window was not indexed correctly. (:issue:`47721`, :issue:`52407`, :issue:`54518`, :issue:`55343`)
1153-
- Bug in :meth:`DataFrameGroupBy.agg` where `numeric_only=True` was ignored when passing a list of aggregation functions (:issue:`49352`)
1153+
- Bug in :meth:`DataFrameGroupBy.agg` where ``numeric_only=True`` was ignored when passing a list of aggregation functions (:issue:`49352`)
11541154

11551155
Reshaping
11561156
^^^^^^^^^
@@ -1204,6 +1204,7 @@ Other
12041204
- Bug in :func:`eval` with ``engine="numexpr"`` returning unexpected result for float division. (:issue:`59736`)
12051205
- Bug in :func:`to_numeric` raising ``TypeError`` when ``arg`` is a :class:`Timedelta` or :class:`Timestamp` scalar. (:issue:`59944`)
12061206
- Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
1207+
- Bug in :meth:`DataFrame.agg` where ``numeric_only=True`` was ignored when passing a list of aggregation functions, causing non-numeric columns to be included or raising TypeError (:issue:`49352`)
12071208
- Bug in :meth:`DataFrame.apply` raising ``RecursionError`` when passing ``func=list[int]``. (:issue:`61565`)
12081209
- Bug in :meth:`DataFrame.apply` where passing ``engine="numba"`` ignored ``args`` passed to the applied function (:issue:`58712`)
12091210
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which caused an exception when using NumPy attributes via ``@`` notation, e.g., ``df.eval("@np.floor(a)")``. (:issue:`58041`)
@@ -1243,7 +1244,7 @@ Other
12431244
- Fixed bug in the :meth:`Series.rank` with object dtype and extremely small float values (:issue:`62036`)
12441245
- Fixed bug where the :class:`DataFrame` constructor misclassified array-like objects with a ``.name`` attribute as :class:`Series` or :class:`Index` (:issue:`61443`)
12451246
- Fixed regression in :meth:`DataFrame.from_records` not initializing subclasses properly (:issue:`57008`)
1246-
- Bug in :meth:`DataFrame.agg` where `numeric_only=True` was ignored when passing a list of aggregation functions, causing non-numeric columns to be included or raising TypeError (:issue:49352)
1247+
12471248
.. ***DO NOT USE THIS SECTION***
12481249
12491250
-

pandas/core/apply.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,15 +849,20 @@ def agg_or_apply_list_like(
849849
# Only proceed if we have numeric columns
850850
if not numeric_obj.empty:
851851
# Create kwargs without numeric_only to avoid passing it to Series methods
852-
kwargs_filtered = {k: v for k, v in kwargs.items() if k != "numeric_only"}
852+
kwargs_filtered = {
853+
k: v for k, v in kwargs.items() if k != "numeric_only"
854+
}
853855

854856
# Compute with filtered object and cleaned kwargs
855-
keys, results = self.compute_list_like(op_name, numeric_obj, kwargs_filtered)
857+
keys, results = self.compute_list_like(
858+
op_name, numeric_obj, kwargs_filtered
859+
)
856860
result = self.wrap_results_list_like(keys, results)
857861
return result
858862
else:
859863
# No numeric columns - return empty result
860864
from pandas import DataFrame
865+
861866
# Get function names for index
862867
keys = list(self.func) if is_list_like(self.func) else []
863868
return DataFrame(index=keys)

0 commit comments

Comments
 (0)