Skip to content

Commit 45fb444

Browse files
authored
REF: call _ensure_valid_index inside _sanitize_column (#38349)
1 parent 9b8f50b commit 45fb444

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pandas/core/frame.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3212,7 +3212,6 @@ def _setitem_frame(self, key, value):
32123212
self._where(-key, value, inplace=True)
32133213

32143214
def _iset_item(self, loc: int, value):
3215-
self._ensure_valid_index(value)
32163215

32173216
# technically _sanitize_column expects a label, not a position,
32183217
# but the behavior is the same as long as we pass broadcast=False
@@ -3235,7 +3234,6 @@ def _set_item(self, key, value):
32353234
Series/TimeSeries will be conformed to the DataFrames index to
32363235
ensure homogeneity.
32373236
"""
3238-
self._ensure_valid_index(value)
32393237
value = self._sanitize_column(key, value)
32403238
NDFrame._set_item(self, key, value)
32413239

@@ -3755,7 +3753,6 @@ def insert(self, loc, column, value, allow_duplicates=False) -> None:
37553753
"Cannot specify 'allow_duplicates=True' when "
37563754
"'self.flags.allows_duplicate_labels' is False."
37573755
)
3758-
self._ensure_valid_index(value)
37593756
value = self._sanitize_column(column, value, broadcast=False)
37603757
self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
37613758

@@ -3846,6 +3843,7 @@ def _sanitize_column(self, key, value, broadcast=True):
38463843
-------
38473844
numpy.ndarray
38483845
"""
3846+
self._ensure_valid_index(value)
38493847

38503848
def reindexer(value):
38513849
# reindex if necessary

0 commit comments

Comments
 (0)