@@ -381,7 +381,9 @@ def isna(self):
381
381
if len (self ._data ) == 0 :
382
382
# True or False doesn't matter--we just need the value for the type
383
383
return np .full ((0 ), True )
384
- return self ._data .map (lambda x : pd .isna (x ) or (isinstance (x , UFloat ) and unp .isnan (x )))
384
+ return self ._data .map (
385
+ lambda x : pd .isna (x ) or (isinstance (x , UFloat ) and unp .isnan (x ))
386
+ )
385
387
return self ._data .isna ()
386
388
387
389
def astype (self , dtype , copy = True ):
@@ -558,7 +560,12 @@ def quantify_nan(item, promote_to_ufloat):
558
560
)
559
561
else :
560
562
promote_to_ufloat = False
561
- scalars = [item if isinstance (item , _Quantity ) else quantify_nan (item , promote_to_ufloat ) for item in scalars ]
563
+ scalars = [
564
+ item
565
+ if isinstance (item , _Quantity )
566
+ else quantify_nan (item , promote_to_ufloat )
567
+ for item in scalars
568
+ ]
562
569
scalars = [
563
570
(item .to (dtype .units ).magnitude if hasattr (item , "to" ) else item )
564
571
for item in scalars
@@ -645,7 +652,12 @@ def factorize(
645
652
646
653
codes = [- 1 ] * len (self .data )
647
654
# Note that item is a local variable provided in the loop below
648
- vf = np .vectorize (lambda x : True if (x_na := pd .isna (x ))* (item_na := pd .isna (item )) else (x_na == item_na and x == item ), otypes = [bool ])
655
+ vf = np .vectorize (
656
+ lambda x : True
657
+ if (x_na := pd .isna (x )) * (item_na := pd .isna (item ))
658
+ else (x_na == item_na and x == item ),
659
+ otypes = [bool ],
660
+ )
649
661
for code , item in enumerate (arr ):
650
662
code_mask = vf (self ._data )
651
663
codes = np .where (code_mask , code , codes )
0 commit comments