File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -1624,7 +1624,7 @@ def union_with_duplicates(
1624
1624
repeats = final_count .reindex (unique_vals ).values
1625
1625
return np .repeat (unique_vals , repeats )
1626
1626
1627
-
1627
+ import pandas as pd
1628
1628
def map_array (
1629
1629
arr : ArrayLike ,
1630
1630
mapper ,
@@ -1698,7 +1698,7 @@ def map_array(
1698
1698
# we must convert to python types
1699
1699
#values = arr.astype(object, copy=False)
1700
1700
1701
- if is_integer_dtype (arr ) and is_nullable_dtype (arr .dtype ):
1701
+ if is_integer_dtype (arr ) and is_nullable (arr .dtype ):
1702
1702
def mapper_check (x ):
1703
1703
if x is None :
1704
1704
return pd .NA
Original file line number Diff line number Diff line change @@ -1446,7 +1446,7 @@ def apply_compat(self):
1446
1446
except (ValueError , AttributeError , TypeError ):
1447
1447
result = obj .apply (func , by_row = False )
1448
1448
return result
1449
-
1449
+ import pandas as pd
1450
1450
def apply_standard (self ) -> DataFrame | Series :
1451
1451
# caller is responsible for ensuring that f is Callable
1452
1452
func = cast (Callable , self .func )
@@ -1460,7 +1460,8 @@ def apply_standard(self) -> DataFrame | Series:
1460
1460
1461
1461
#Check if type is integer and nullable, return pd.NA for None values and
1462
1462
#normal func for other values
1463
- if pd .api .types .is_integer_dtype (obj ) and pd .api .types .is_nullable_dtype (obj .dtype ):
1463
+ if pd .api .types .is_integer_dtype (obj ) and
1464
+ pd .api .types .is_nullable (obj .dtype ):
1464
1465
def wrapped_func (x ):
1465
1466
if x is None :
1466
1467
return pd .NA
Original file line number Diff line number Diff line change @@ -4417,7 +4417,8 @@ def map_check(val):
4417
4417
if callable (arg ):
4418
4418
arg = functools .partial (arg , ** kwargs )
4419
4419
new_values = self ._map_values (arg , na_action = na_action )
4420
- return self ._constructor (new_values , index = self .index , copy = False ).__finalize__ (
4420
+ return self ._constructor (new_values , index = self .index , copy = False )
4421
+ .__finalize__ (
4421
4422
self , method = "map"
4422
4423
)
4423
4424
@@ -4619,16 +4620,16 @@ def apply(
4619
4620
Helsinki 2.484907
4620
4621
dtype: float64
4621
4622
"""
4622
- # check if dtype is nullable integer
4623
+ # check if dtype is nullable integer
4623
4624
if pd .api .types .is_integer_dtype (self ) and pd .api .types .is_nullable (self .dtype ):
4624
4625
# def functon to handle NaN as pd.NA
4625
- def apply_check (val ):
4626
- if val is None :
4627
- return pd .NA
4628
- return val
4626
+ def apply_check (val ):
4627
+ if val is None :
4628
+ return pd .NA
4629
+ return val
4629
4630
self = [apply_check (x ) for x in self ]
4630
4631
4631
- #proceed with usual apply method
4632
+ #proceed with usual apply method
4632
4633
return SeriesApply (
4633
4634
self ,
4634
4635
func ,
You can’t perform that action at this time.
0 commit comments