Skip to content

Commit fcadff3

Browse files
authored
CLN: some code cleanups to pandas/_libs/missing.pyx (#32367)
1 parent e2f1bc0 commit fcadff3

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

pandas/_libs/missing.pyx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ cnp.import_array()
1010

1111
cimport pandas._libs.util as util
1212

13-
from pandas._libs.tslibs.np_datetime cimport (
14-
get_timedelta64_value, get_datetime64_value)
13+
14+
from pandas._libs.tslibs.np_datetime cimport get_datetime64_value, get_timedelta64_value
1515
from pandas._libs.tslibs.nattype cimport (
16-
checknull_with_nat, c_NaT as NaT, is_null_datetimelike)
16+
c_NaT as NaT,
17+
checknull_with_nat,
18+
is_null_datetimelike,
19+
)
1720
from pandas._libs.ops_dispatch import maybe_dispatch_ufunc_to_dunder_op
1821

1922
from pandas.compat import is_platform_32bit
@@ -44,7 +47,7 @@ cpdef bint checknull(object val):
4447
4548
Returns
4649
-------
47-
result : bool
50+
bool
4851
4952
Notes
5053
-----
@@ -223,7 +226,7 @@ def isnaobj2d_old(arr: ndarray) -> ndarray:
223226

224227
Returns
225228
-------
226-
result : ndarray (dtype=np.bool_)
229+
ndarray (dtype=np.bool_)
227230

228231
Notes
229232
-----
@@ -248,17 +251,11 @@ def isnaobj2d_old(arr: ndarray) -> ndarray:
248251

249252

250253
def isposinf_scalar(val: object) -> bool:
251-
if util.is_float_object(val) and val == INF:
252-
return True
253-
else:
254-
return False
254+
return util.is_float_object(val) and val == INF
255255

256256

257257
def isneginf_scalar(val: object) -> bool:
258-
if util.is_float_object(val) and val == NEGINF:
259-
return True
260-
else:
261-
return False
258+
return util.is_float_object(val) and val == NEGINF
262259

263260

264261
cdef inline bint is_null_datetime64(v):
@@ -426,7 +423,6 @@ class NAType(C_NAType):
426423
return NA
427424
elif isinstance(other, np.ndarray):
428425
return np.where(other == 1, other, NA)
429-
430426
return NotImplemented
431427

432428
# Logical ops using Kleene logic
@@ -436,8 +432,7 @@ class NAType(C_NAType):
436432
return False
437433
elif other is True or other is C_NA:
438434
return NA
439-
else:
440-
return NotImplemented
435+
return NotImplemented
441436

442437
__rand__ = __and__
443438

@@ -446,8 +441,7 @@ class NAType(C_NAType):
446441
return True
447442
elif other is False or other is C_NA:
448443
return NA
449-
else:
450-
return NotImplemented
444+
return NotImplemented
451445

452446
__ror__ = __or__
453447

0 commit comments

Comments
 (0)