Skip to content

Commit 51a6455

Browse files
committed
Fix logic for column access in result dictionary in DataFrame.combine.
1 parent b553d69 commit 51a6455

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9123,7 +9123,7 @@ def combine(
91239123
# don't overwrite columns unnecessarily
91249124
# DO propagate if this column is not in the intersection
91259125
if not overwrite and other_mask.all():
9126-
result.iloc[:, i] = this.iloc[:, i].copy()
9126+
result[this.columns[i]] = this.iloc[:, i].copy()
91279127
continue
91289128

91299129
if do_fill:
@@ -9157,7 +9157,7 @@ def combine(
91579157
arr, new_dtype
91589158
)
91599159

9160-
result[new_columns[i]] = arr
9160+
result[this.columns[i]] = arr
91619161

91629162
# convert_objects just in case
91639163
frame_result = self._constructor(result, index=new_index, columns=new_columns)

0 commit comments

Comments
 (0)