Skip to content

Commit 1b439d8

Browse files
committed
py312+ compat
1 parent 56ddf75 commit 1b439d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pandas/core/indexing.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,15 @@ def _maybe_warn_non_casting_setitem(self, key, value) -> None:
956956
and key[0] == slice(None)
957957
):
958958
# This is a `df.loc[:, foo] = bar` call
959-
if is_hashable(key[1]) and key[1] in self.obj.columns:
959+
if (
960+
is_hashable(key[1])
961+
and not isinstance(key[1], slice)
962+
and not (
963+
isinstance(key[1], tuple)
964+
and any(isinstance(x, slice) for x in key[1])
965+
)
966+
and key[1] in self.obj.columns
967+
):
960968
obj = self.obj[key[1]]
961969
if isinstance(obj, ABCSeries) and isinstance(
962970
value, (ABCSeries, Index, ExtensionArray, np.ndarray)

0 commit comments

Comments
 (0)