本文整理汇总了Python中pandas.core.nanops.nansem方法的典型用法代码示例。如果您正苦于以下问题:Python nanops.nansem方法的具体用法?Python nanops.nansem怎么用?Python nanops.nansem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.core.nanops
的用法示例。
在下文中一共展示了nanops.nansem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sem
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nansem [as 别名]
def test_sem(self, float_frame_with_na, datetime_frame,
float_frame, float_string_frame):
alt = lambda x: np.std(x, ddof=1) / np.sqrt(len(x))
assert_stat_op_calc('sem', alt, float_frame_with_na)
assert_stat_op_api('sem', float_frame, float_string_frame)
result = datetime_frame.sem(ddof=4)
expected = datetime_frame.apply(
lambda x: x.std(ddof=4) / np.sqrt(len(x)))
tm.assert_almost_equal(result, expected)
arr = np.repeat(np.random.random((1, 1000)), 1000, 0)
result = nanops.nansem(arr, axis=0)
assert not (result < 0).any()
with pd.option_context('use_bottleneck', False):
result = nanops.nansem(arr, axis=0)
assert not (result < 0).any()
示例2: test_sem
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nansem [as 别名]
def test_sem(self):
alt = lambda x: np.std(x, ddof=1) / np.sqrt(len(x))
self._check_stat_op('sem', alt)
result = self.tsframe.sem(ddof=4)
expected = self.tsframe.apply(
lambda x: x.std(ddof=4) / np.sqrt(len(x)))
tm.assert_almost_equal(result, expected)
arr = np.repeat(np.random.random((1, 1000)), 1000, 0)
result = nanops.nansem(arr, axis=0)
assert not (result < 0).any()
with pd.option_context('use_bottleneck', False):
result = nanops.nansem(arr, axis=0)
assert not (result < 0).any()
示例3: test_nansem
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nansem [as 别名]
def test_nansem(self, ddof):
from scipy.stats import sem
with np.errstate(invalid='ignore'):
self.check_funs(nanops.nansem, sem, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=False, allow_obj='convert', ddof=ddof)
示例4: sem
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nansem [as 别名]
def sem(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='sem')
return nanops.nansem(self._ndarray, axis=axis, skipna=skipna,
ddof=ddof)
示例5: test_nansem
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nansem [as 别名]
def test_nansem(self):
tm.skip_if_no_package('scipy', min_version='0.17.0')
from scipy.stats import sem
with np.errstate(invalid='ignore'):
self.check_funs_ddof(nanops.nansem, sem, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=False, allow_obj='convert')