本文整理汇总了Python中pandas.core.nanops.nancov方法的典型用法代码示例。如果您正苦于以下问题:Python nanops.nancov方法的具体用法?Python nanops.nancov怎么用?Python nanops.nancov使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.core.nanops
的用法示例。
在下文中一共展示了nanops.nancov方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cov
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nancov [as 别名]
def cov(self, other, min_periods=None):
"""
Compute covariance with Series, excluding missing values.
Parameters
----------
other : Series
min_periods : int, optional
Minimum number of observations needed to have a valid result
Returns
-------
covariance : float
Normalized by N-1 (unbiased estimator).
"""
this, other = self.align(other, join='inner', copy=False)
if len(this) == 0:
return np.nan
return nanops.nancov(this.values, other.values,
min_periods=min_periods)
示例2: cov
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nancov [as 别名]
def cov(self, other, min_periods=None):
"""
Compute covariance with Series, excluding missing values
Parameters
----------
other : Series
min_periods : int, optional
Minimum number of observations needed to have a valid result
Returns
-------
covariance : float
Normalized by N-1 (unbiased estimator).
"""
this, other = self.align(other, join='inner', copy=False)
if len(this) == 0:
return np.nan
return nanops.nancov(this.values, other.values,
min_periods=min_periods)
示例3: cov
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nancov [as 别名]
def cov(self, other, min_periods=None):
"""
Compute covariance with Series, excluding missing values
Parameters
----------
other : Series
min_periods : int, optional
Minimum number of observations needed to have a valid result
Returns
-------
covariance : float
Normalized by N-1 (unbiased estimator).
"""
this, other = self.align(other, join='inner')
if len(this) == 0:
return pa.NA
return nanops.nancov(this.values, other.values,
min_periods=min_periods)
示例4: test_nancov
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nancov [as 别名]
def test_nancov(self):
targ0 = np.cov(self.arr_float_2d, self.arr_float1_2d)[0, 1]
targ1 = np.cov(self.arr_float_2d.flat, self.arr_float1_2d.flat)[0, 1]
self.check_nancorr_nancov_2d(nanops.nancov, targ0, targ1)
targ0 = np.cov(self.arr_float_1d, self.arr_float1_1d)[0, 1]
targ1 = np.cov(self.arr_float_1d.flat, self.arr_float1_1d.flat)[0, 1]
self.check_nancorr_nancov_1d(nanops.nancov, targ0, targ1)