Skip to content

Commit

Permalink
CLN: removing get_stargets from DatetimeEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhlim committed May 10, 2021
1 parent 10f9886 commit ec67841
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
8 changes: 0 additions & 8 deletions pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,6 @@ cdef class DatetimeEngine(Int64Engine):
except KeyError:
raise KeyError(val)

def get_stargets(self, ndarray targets) -> set:
stargets = set(targets)
# account for NaTs
if -1 not in stargets and isnaobj(targets).any():
stargets.add(-1)

return stargets

def get_indexer_non_unique(self, ndarray targets):
# we may get datetime64[ns] or timedelta64[ns], cast these to int64
return super().get_indexer_non_unique(targets.view("i8"))
Expand Down
9 changes: 2 additions & 7 deletions pandas/tests/indexes/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ def test_getitem_deprecated_float(idx):
"idx,targets",
[
(Index([]), np.array([None])),
(Index([]), np.array([NaT])),
(Float64Index([]), np.array([np.nan])),
(DatetimeIndex([]), np.array([NaT])),
],
)
def test_get_stargets(idx, targets):
Expand All @@ -278,12 +278,7 @@ def test_get_stargets(idx, targets):

@pytest.mark.parametrize(
"idx,val,expected",
[
(Index([]), None, -1),
(Int64Index([]), 1, 1),
(Float64Index([]), np.nan, -1),
(DatetimeIndex([]), NaT, -1),
],
[(Index([]), None, -1), (Int64Index([]), 1, 1), (Float64Index([]), np.nan, -1)],
)
def test_convert_val_if_nan(idx, val, expected):
# GH 35392
Expand Down

0 comments on commit ec67841

Please sign in to comment.