Skip to content

Commit

Permalink
REMOVE the masking approach .loc using arrays of booleans ( now entir…
Browse files Browse the repository at this point in the history
…ely w/in pushdown code ) (modin-project#40) [no upstream]

* Simplify the masking approach to .loc

* Remove iloc hack code for loc support
  • Loading branch information
jkew committed May 5, 2023
1 parent 6506548 commit 1a4aecb
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions modin/pandas/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,25 +633,6 @@ def __getitem__(self, key):
if self.df.empty:
return self.df._default_to_pandas(lambda df: df.loc[key])

# Limited support for slicing operations on loc, and predominantly
# only with positional mapping by translating it to an iloc. To
# support proper labels (sorted) we will need to translate the
# existing index to a mask OR translate the expression to a set of
# predicates.
if is_slice(key):
if key.step is not None:
raise NotImplementedError("Slice with step not supported for loc")
if key.start is None and key.stop is None:
return self.df
if key.start is None:
arr = (self.df.index <= key.stop)
return self.df.iloc[ arr ]
if key.stop is None:
arr = (self.df.index >= key.start)
return self.df.iloc[ arr ]
# Works for a positional mapping
return self.df.iloc[ key.start : ( key.stop + 1) ]

if (
isinstance(key, tuple)
and len(key) == 2
Expand Down Expand Up @@ -1010,7 +991,6 @@ def __getitem__(self, key):
col_scalar = is_scalar(col_loc)
self._check_dtypes(row_loc)
self._check_dtypes(col_loc)

if isinstance(row_loc, Series) and is_boolean_array(row_loc):
return self._handle_boolean_masking(row_loc, col_loc)

Expand Down

0 comments on commit 1a4aecb

Please sign in to comment.