Skip to content

Commit 3e25a36

Browse files
authored
CLN: remove redundant variable in setitem_with_indexer (pandas-dev#37563)
1 parent cd649a2 commit 3e25a36

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pandas/core/indexing.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1645,19 +1645,14 @@ def _setitem_with_indexer_split_path(self, indexer, value):
16451645
if isinstance(value, ABCSeries):
16461646
value = self._align_series(indexer, value)
16471647

1648-
info_idx = indexer[1]
1649-
if is_integer(info_idx):
1650-
info_idx = [info_idx]
1651-
labels = self.obj.columns[info_idx]
1652-
16531648
# Ensure we have something we can iterate over
16541649
ilocs = self._ensure_iterable_column_indexer(indexer[1])
16551650

16561651
plane_indexer = indexer[:1]
16571652
lplane_indexer = length_of_indexer(plane_indexer[0], self.obj.index)
16581653
# lplane_indexer gives the expected length of obj[indexer[0]]
16591654

1660-
if len(labels) == 1:
1655+
if len(ilocs) == 1:
16611656
# We can operate on a single column
16621657

16631658
# require that we are setting the right number of values that
@@ -1678,20 +1673,20 @@ def _setitem_with_indexer_split_path(self, indexer, value):
16781673
if isinstance(value, ABCDataFrame):
16791674
self._setitem_with_indexer_frame_value(indexer, value)
16801675

1681-
# we have an equal len ndarray/convertible to our labels
1676+
# we have an equal len ndarray/convertible to our ilocs
16821677
# hasattr first, to avoid coercing to ndarray without reason.
16831678
# But we may be relying on the ndarray coercion to check ndim.
16841679
# Why not just convert to an ndarray earlier on if needed?
16851680
elif np.ndim(value) == 2:
16861681
self._setitem_with_indexer_2d_value(indexer, value)
16871682

16881683
elif (
1689-
len(labels) == 1
1684+
len(ilocs) == 1
16901685
and lplane_indexer == len(value)
16911686
and not is_scalar(plane_indexer[0])
16921687
):
16931688
# we have an equal len list/ndarray
1694-
# We only get here with len(labels) == len(ilocs) == 1
1689+
# We only get here with len(ilocs) == 1
16951690
self._setitem_single_column(ilocs[0], value, plane_indexer)
16961691

16971692
elif lplane_indexer == 0 and len(value) == len(self.obj.index):

0 commit comments

Comments
 (0)