@@ -2667,7 +2667,7 @@ def quantile(
26672667 return self ._constructor (result , index = idx , name = self .name )
26682668 else :
26692669 # scalar
2670- return result .iloc [0 ]
2670+ return maybe_unbox_numpy_scalar ( result .iloc [0 ])
26712671
26722672 def corr (
26732673 self ,
@@ -2754,9 +2754,11 @@ def corr(
27542754 other_values = other .to_numpy (dtype = float , na_value = np .nan , copy = False )
27552755
27562756 if method in ["pearson" , "spearman" , "kendall" ] or callable (method ):
2757- return nanops .nancorr (
2757+ result = nanops .nancorr (
27582758 this_values , other_values , method = method , min_periods = min_periods
27592759 )
2760+ result = maybe_unbox_numpy_scalar (result )
2761+ return result
27602762
27612763 raise ValueError (
27622764 "method must be either 'pearson', "
@@ -2808,9 +2810,11 @@ def cov(
28082810 return np .nan
28092811 this_values = this .to_numpy (dtype = float , na_value = np .nan , copy = False )
28102812 other_values = other .to_numpy (dtype = float , na_value = np .nan , copy = False )
2811- return nanops .nancov (
2813+ result = nanops .nancov (
28122814 this_values , other_values , min_periods = min_periods , ddof = ddof
28132815 )
2816+ result = maybe_unbox_numpy_scalar (result )
2817+ return result
28142818
28152819 @doc (
28162820 klass = "Series" ,
@@ -3023,11 +3027,12 @@ def dot(self, other: AnyArrayLike | DataFrame) -> Series | np.ndarray:
30233027 np .dot (lvals , rvals ), index = other .columns , copy = False , dtype = common_type
30243028 ).__finalize__ (self , method = "dot" )
30253029 elif isinstance (other , Series ):
3026- return np .dot (lvals , rvals )
3030+ result = np .dot (lvals , rvals )
30273031 elif isinstance (rvals , np .ndarray ):
3028- return np .dot (lvals , rvals )
3032+ result = np .dot (lvals , rvals )
30293033 else : # pragma: no cover
30303034 raise TypeError (f"unsupported type: { type (other )} " )
3035+ return maybe_unbox_numpy_scalar (result )
30313036
30323037 def __matmul__ (self , other ):
30333038 """
@@ -5701,7 +5706,7 @@ def pop(self, item: Hashable) -> Any:
57015706 2 3
57025707 dtype: int64
57035708 """
5704- return super ().pop (item = item )
5709+ return maybe_unbox_numpy_scalar ( super ().pop (item = item ) )
57055710
57065711 def info (
57075712 self ,
0 commit comments