Skip to content

CLN: remove NaT.__int__, __long__ #39470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2021
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
6 changes: 0 additions & 6 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,6 @@ cdef class _NaT(datetime):
def __hash__(self):
return NPY_NAT

def __int__(self):
return NPY_NAT

def __long__(self):
return NPY_NAT

@property
def is_leap_year(self) -> bool:
return False
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def factorize(
values, dtype = _ensure_data(values)

if original.dtype.kind in ["m", "M"]:
na_value = na_value_for_dtype(original.dtype)
na_value = iNaT
else:
na_value = None

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ def _round(self, freq, mode, ambiguous, nonexistent):

values = self.view("i8")
result = round_nsint64(values, mode, freq)
result = self._maybe_mask_results(result, fill_value=NaT)
result = self._maybe_mask_results(result, fill_value=iNaT)
return self._simple_new(result, dtype=self.dtype)

@Appender((_round_doc + _round_example).format(op="round"))
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/arithmetic/test_timedelta64.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def test_tdi_add_overflow(self):
with pytest.raises(OutOfBoundsDatetime, match="10155196800000000000"):
Timestamp("2000") + pd.to_timedelta(106580, "D")

_NaT = int(pd.NaT) + 1
_NaT = pd.NaT.value + 1
msg = "Overflow in int64 addition"
with pytest.raises(OverflowError, match=msg):
pd.to_timedelta([106580], "D") + Timestamp("2000")
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_sort_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def test_sort_values_nat_values_in_int_column(self):
# cause was that the int64 value NaT was considered as "na". Which is
# only correct for datetime64 columns.

int_values = (2, int(NaT))
int_values = (2, int(NaT.value))
float_values = (2.0, -1.797693e308)

df = DataFrame(
Expand Down