当前位置: 首页>>代码示例>>Python>>正文


Python nanops.nanstd方法代码示例

本文整理汇总了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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:6,代码来源:test_nanops.py

示例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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:test_nanops.py

示例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]) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:31,代码来源:test_nanops.py

示例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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:numpy_.py

示例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') 
开发者ID:securityclippy,项目名称:elasticintel,代码行数:6,代码来源:test_nanops.py


注:本文中的pandas.core.nanops.nanstd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。