Skip to content

Commit 9f76217

Browse files
committed
Use RangeIndex placeholder for DataFrame.reduce
1 parent c3bace8 commit 9f76217

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12180,6 +12180,7 @@ def _get_data() -> DataFrame:
1218012180
# simple case where we can use BlockManager.reduce
1218112181
res = df._mgr.reduce(blk_func)
1218212182
out = df._constructor_from_mgr(res, axes=res.axes).iloc[0]
12183+
out.name = None
1218312184
if out_dtype is not None and out.dtype != "boolean":
1218412185
out = out.astype(out_dtype)
1218512186
elif (df._mgr.get_dtypes() == object).any() and name not in ["any", "all"]:

pandas/core/internals/managers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ def reduce(self, func: Callable) -> Self:
16561656
nbs = blk.reduce(func)
16571657
res_blocks.extend(nbs)
16581658

1659-
index = Index([None]) # placeholder
1659+
index = default_index(1) # placeholder
16601660
new_mgr = type(self).from_blocks(res_blocks, [self.items, index])
16611661
return new_mgr
16621662

0 commit comments

Comments
 (0)