Skip to content

Commit b7f8982

Browse files
committed
BUG: pandas-devGH-23236 fix .iat assignment creates new column on type error
1 parent 1ebfd8a commit b7f8982

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/frame.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,10 @@ def _set_value(self, index, col, value, takeable=False):
27162716
except (KeyError, TypeError):
27172717

27182718
# set using a non-recursive method & reset the cache
2719-
self.loc[index, col] = value
2719+
if takeable:
2720+
self.iloc[index, col] = value
2721+
else:
2722+
self.loc[index, col] = value
27202723
self._item_cache.pop(col, None)
27212724

27222725
return self

0 commit comments

Comments
 (0)