Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7047,7 +7047,7 @@ def fillna(
# see test_fillna_dict_inplace_nonunique_columns
locs = result.columns.get_loc(k)
if isinstance(locs, slice):
locs = np.arange(self.shape[1])[locs]
locs = range(self.shape[1])[locs]
elif isinstance(locs, np.ndarray) and locs.dtype.kind == "b":
locs = locs.nonzero()[0]
elif not (
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2308,11 +2308,11 @@ def _ensure_iterable_column_indexer(self, column_indexer):
"""
Ensure that our column indexer is something that can be iterated over.
"""
ilocs: Sequence[int | np.integer] | np.ndarray
ilocs: Sequence[int | np.integer] | np.ndarray | range
if is_integer(column_indexer):
ilocs = [column_indexer]
elif isinstance(column_indexer, slice):
ilocs = np.arange(len(self.obj.columns))[column_indexer]
ilocs = range(len(self.obj.columns))[column_indexer]
elif (
isinstance(column_indexer, np.ndarray) and column_indexer.dtype.kind == "b"
):
Expand Down