Skip to content

CLN: Remove is_null_period #33750

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
Apr 23, 2020
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
9 changes: 6 additions & 3 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ cimport pandas._libs.util as util
from pandas._libs.util cimport is_nan, UINT64_MAX, INT64_MAX, INT64_MIN

from pandas._libs.tslib import array_to_datetime
from pandas._libs.tslibs.nattype cimport NPY_NAT, c_NaT as NaT
from pandas._libs.tslibs.nattype cimport (
NPY_NAT,
c_NaT as NaT,
checknull_with_nat,
)
from pandas._libs.tslibs.conversion cimport convert_to_tsobject
from pandas._libs.tslibs.timedeltas cimport convert_to_timedelta64
from pandas._libs.tslibs.timezones cimport get_timezone, tz_compare
Expand All @@ -77,7 +81,6 @@ from pandas._libs.missing cimport (
isnaobj,
is_null_datetime64,
is_null_timedelta64,
is_null_period,
C_NA,
)

Expand Down Expand Up @@ -1844,7 +1847,7 @@ cdef class PeriodValidator(TemporalValidator):
return util.is_period_object(value)

cdef inline bint is_valid_null(self, object value) except -1:
return is_null_period(value)
return checknull_with_nat(value)


cpdef bint is_period_array(ndarray values):
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/missing.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ cpdef ndarray[uint8_t] isnaobj(ndarray arr)

cdef bint is_null_datetime64(v)
cdef bint is_null_timedelta64(v)
cdef bint is_null_period(v)

cdef class C_NAType:
pass
Expand Down
7 changes: 1 addition & 6 deletions pandas/_libs/missing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cpdef bint checknull(object val):
- NaT
- np.datetime64 representation of NaT
- np.timedelta64 representation of NaT
- NA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an unrelated cleanup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just noticed that was missing from the docstring so added it here


Parameters
----------
Expand Down Expand Up @@ -278,12 +279,6 @@ cdef inline bint is_null_timedelta64(v):
return False


cdef inline bint is_null_period(v):
# determine if we have a null for a Period (or integer versions),
# excluding np.datetime64('nat') and np.timedelta64('nat')
return checknull_with_nat(v)


# -----------------------------------------------------------------------------
# Implementation of NA singleton

Expand Down