Skip to content

Commit 7f2c8df

Browse files
committed
Fixes #24893: use .apply for maybe_downcast_to_dtype in margins
1 parent f9bb63b commit 7f2c8df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/reshape/pivot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _add_margins(
254254
try:
255255
for dtype in set(result.dtypes):
256256
cols = result.select_dtypes([dtype]).columns
257-
margin_dummy[cols] = maybe_downcast_to_dtype(margin_dummy[cols], dtype)
257+
margin_dummy[cols] = margin_dummy[cols].apply(maybe_downcast_to_dtype, args=(dtype,))
258258
result = result.append(margin_dummy)
259259
except TypeError:
260260

0 commit comments

Comments
 (0)