本文整理匯總了Python中pandas.core.nanops.nanstd方法的典型用法代碼示例。如果您正苦於以下問題:Python nanops.nanstd方法的具體用法?Python nanops.nanstd怎麽用?Python nanops.nanstd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.core.nanops
的用法示例。
在下文中一共展示了nanops.nanstd方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_nanstd
# 需要導入模塊: from pandas.core import nanops [as 別名]
# 或者: from pandas.core.nanops import nanstd [as 別名]
def test_nanstd(self, ddof):
self.check_funs(nanops.nanstd, np.std, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=True, allow_obj='convert', ddof=ddof)
示例2: test_nanstd_nans
# 需要導入模塊: from pandas.core import nanops [as 別名]
# 或者: from pandas.core.nanops import nanstd [as 別名]
def test_nanstd_nans(self):
samples = np.nan * np.ones(2 * self.samples.shape[0])
samples[::2] = self.samples
actual_std = nanops.nanstd(samples, skipna=True)
tm.assert_almost_equal(actual_std, self.variance ** 0.5,
check_less_precise=2)
actual_std = nanops.nanvar(samples, skipna=False)
tm.assert_almost_equal(actual_std, np.nan,
check_less_precise=2)
示例3: test_ground_truth
# 需要導入模塊: from pandas.core import nanops [as 別名]
# 或者: from pandas.core.nanops import nanstd [as 別名]
def test_ground_truth(self):
# Test against values that were precomputed with Numpy.
samples = np.empty((4, 4))
samples[:3, :3] = np.array([[0.97303362, 0.21869576, 0.55560287
], [0.72980153, 0.03109364, 0.99155171],
[0.09317602, 0.60078248, 0.15871292]])
samples[3] = samples[:, 3] = np.nan
# Actual variances along axis=0, 1 for ddof=0, 1, 2
variance = np.array([[[0.13762259, 0.05619224, 0.11568816
], [0.20643388, 0.08428837, 0.17353224],
[0.41286776, 0.16857673, 0.34706449]],
[[0.09519783, 0.16435395, 0.05082054
], [0.14279674, 0.24653093, 0.07623082],
[0.28559348, 0.49306186, 0.15246163]]])
# Test nanvar.
for axis in range(2):
for ddof in range(3):
var = nanops.nanvar(samples, skipna=True, axis=axis, ddof=ddof)
tm.assert_almost_equal(var[:3], variance[axis, ddof])
assert np.isnan(var[3])
# Test nanstd.
for axis in range(2):
for ddof in range(3):
std = nanops.nanstd(samples, skipna=True, axis=axis, ddof=ddof)
tm.assert_almost_equal(std[:3], variance[axis, ddof] ** 0.5)
assert np.isnan(std[3])
示例4: std
# 需要導入模塊: from pandas.core import nanops [as 別名]
# 或者: from pandas.core.nanops import nanstd [as 別名]
def std(self, axis=None, dtype=None, out=None, ddof=1, keepdims=False,
skipna=True):
nv.validate_stat_ddof_func((), dict(dtype=dtype, out=out,
keepdims=keepdims),
fname='std')
return nanops.nanstd(self._ndarray, axis=axis, skipna=skipna,
ddof=ddof)
示例5: test_nanstd
# 需要導入模塊: from pandas.core import nanops [as 別名]
# 或者: from pandas.core.nanops import nanstd [as 別名]
def test_nanstd(self):
self.check_funs_ddof(nanops.nanstd, np.std, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=True, allow_obj='convert')