Skip to content

Commit 99289e9

Browse files
authored
CLN: remove NaT.__int__, __long__ (#39470)
1 parent cc3099a commit 99289e9

File tree

5 files changed

+4
-10
lines changed

5 files changed

+4
-10
lines changed

pandas/_libs/tslibs/nattype.pyx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ cdef class _NaT(datetime):
286286
def __hash__(self):
287287
return NPY_NAT
288288

289-
def __int__(self):
290-
return NPY_NAT
291-
292-
def __long__(self):
293-
return NPY_NAT
294-
295289
@property
296290
def is_leap_year(self) -> bool:
297291
return False

pandas/core/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def factorize(
715715
values, dtype = _ensure_data(values)
716716

717717
if original.dtype.kind in ["m", "M"]:
718-
na_value = na_value_for_dtype(original.dtype)
718+
na_value = iNaT
719719
else:
720720
na_value = None
721721

pandas/core/arrays/datetimelike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ def _round(self, freq, mode, ambiguous, nonexistent):
16071607

16081608
values = self.view("i8")
16091609
result = round_nsint64(values, mode, freq)
1610-
result = self._maybe_mask_results(result, fill_value=NaT)
1610+
result = self._maybe_mask_results(result, fill_value=iNaT)
16111611
return self._simple_new(result, dtype=self.dtype)
16121612

16131613
@Appender((_round_doc + _round_example).format(op="round"))

pandas/tests/arithmetic/test_timedelta64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def test_tdi_add_overflow(self):
679679
with pytest.raises(OutOfBoundsDatetime, match="10155196800000000000"):
680680
Timestamp("2000") + pd.to_timedelta(106580, "D")
681681

682-
_NaT = int(pd.NaT) + 1
682+
_NaT = pd.NaT.value + 1
683683
msg = "Overflow in int64 addition"
684684
with pytest.raises(OverflowError, match=msg):
685685
pd.to_timedelta([106580], "D") + Timestamp("2000")

pandas/tests/frame/methods/test_sort_values.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def test_sort_values_nat_values_in_int_column(self):
323323
# cause was that the int64 value NaT was considered as "na". Which is
324324
# only correct for datetime64 columns.
325325

326-
int_values = (2, int(NaT))
326+
int_values = (2, int(NaT.value))
327327
float_values = (2.0, -1.797693e308)
328328

329329
df = DataFrame(

0 commit comments

Comments
 (0)