modin/pandas/series.py
def corr(self, other, method="pearson", min_periods=None):  # noqa: PR01, RT01, D200
        """
        Compute correlation with `other` Series, excluding missing values.
        """
        if method == "pearson":
            this, other = self.align(other, join="inner", copy=False)
            this = self.__constructor__(this)
            other = self.__constructor__(other)

            if len(this) == 0:
                return np.nan
            if len(this) != len(other):
                raise ValueError("Operands must have same size")

            if min_periods is None:
                min_periods = 1

            valid = this.notna() & other.notna()
            if not valid.all():
                this = this[valid]
                other = other[valid]
            if len(this) < min_periods:
                return np.nan

            this = this.astype(dtype="float64")
            other = other.astype(dtype="float64")
            this -= this.mean()
            other -= other.mean()

            other = other.__constructor__(query_compiler=other._query_compiler.conj())
            result = this * other / (len(this) - 1)
            result = np.array([result.sum()])

            stddev_this = ((this * this) / (len(this) - 1)).sum()
            stddev_other = ((other * other) / (len(other) - 1)).sum()

            stddev_this = np.array([np.sqrt(stddev_this)])
            stddev_other = np.array([np.sqrt(stddev_other)])

            result /= stddev_this * stddev_other

            np.clip(result.real, -1, 1, out=result.real)
            if np.iscomplexobj(result):
                np.clip(result.imag, -1, 1, out=result.imag)
            return result[0]

        return self.__constructor__(
            query_compiler=self._query_compiler.default_to_pandas(
                pandas.Series.corr,
                other._query_compiler,
                method=method,
                min_periods=min_periods,
            )
        )

        Compute correlation with `other` Series, excluding missing values.
        
Compute correlation with `other` Series, excluding missing values.
Compute correlation with ` other ` Series excluding missing values .
def corr(self, other, method="pearson", min_periods=None):  
        if method == "pearson":
            this, other = self.align(other, join="inner", copy=False)
            this = self.__constructor__(this)
            other = self.__constructor__(other)
            if len(this) == 0:
                return np.nan
            if len(this) != len(other):
                raise ValueError("Operands must have same size")
            if min_periods is None:
                min_periods = 1
            valid = this.notna() & other.notna()
            if not valid.all():
                this = this[valid]
                other = other[valid]
            if len(this) < min_periods:
                return np.nan
            this = this.astype(dtype="float64")
            other = other.astype(dtype="float64")
            this -= this.mean()
            other -= other.mean()
            other = other.__constructor__(query_compiler=other._query_compiler.conj())
            result = this * other / (len(this) - 1)
            result = np.array([result.sum()])
            stddev_this = ((this * this) / (len(this) - 1)).sum()
            stddev_other = ((other * other) / (len(other) - 1)).sum()
            stddev_this = np.array([np.sqrt(stddev_this)])
            stddev_other = np.array([np.sqrt(stddev_other)])
            result /= stddev_this * stddev_other
            np.clip(result.real, -1, 1, out=result.real)
            if np.iscomplexobj(result):
                np.clip(result.imag, -1, 1, out=result.imag)
            return result[0]
        return self.__constructor__(
            query_compiler=self._query_compiler.default_to_pandas(
                pandas.Series.corr,
                other._query_compiler,
                method=method,
                min_periods=min_periods,
            )
        )
def corr ( self , other , method = "pearson" , min_periods = None ) : if method == "pearson" : this , other = self . align ( other , join = "inner" , copy = False ) this = self . __constructor__ ( this ) other = self . __constructor__ ( other ) if len ( this ) == 0 : return np . nan if len ( this ) != len ( other ) : raise ValueError ( "Operands must have same size" ) if min_periods is None : min_periods = 1 valid = this . notna ( ) & other . notna ( ) if not valid . all ( ) : this = this [ valid ] other = other [ valid ] if len ( this ) < min_periods : return np . nan this = this . astype ( dtype = "float64" ) other = other . astype ( dtype = "float64" ) this -= this . mean ( ) other -= other . mean ( ) other = other . __constructor__ ( query_compiler = other . _query_compiler . conj ( ) ) result = this * other / ( len ( this ) - 1 ) result = np . array ( [ result . sum ( ) ] ) stddev_this = ( ( this * this ) / ( len ( this ) - 1 ) ) . sum ( ) stddev_other = ( ( other * other ) / ( len ( other ) - 1 ) ) . sum ( ) stddev_this = np . array ( [ np . sqrt ( stddev_this ) ] ) stddev_other = np . array ( [ np . sqrt ( stddev_other ) ] ) result /= stddev_this * stddev_other np . clip ( result . real , - 1 , 1 , out = result . real ) if np . iscomplexobj ( result ) : np . clip ( result . imag , - 1 , 1 , out = result . imag ) return result [ 0 ] return self . __constructor__ ( query_compiler = self . _query_compiler . default_to_pandas ( pandas . Series . corr , other . _query_compiler , method = method , min_periods = min_periods , ) )
Compute correlation with `other` Series, excluding missing values.
Compute correlation with ` other ` Series excluding missing values .
# noqa: PR01, RT01, D200 """
        Compute correlation with `other` Series, excluding missing values.
        """
self
other
method
min_periods