本文整理汇总了Python中pandas.core.nanops.nanmedian方法的典型用法代码示例。如果您正苦于以下问题:Python nanops.nanmedian方法的具体用法?Python nanops.nanmedian怎么用?Python nanops.nanmedian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.core.nanops
的用法示例。
在下文中一共展示了nanops.nanmedian方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_nanmedian
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nanmedian [as 别名]
def test_nanmedian(self):
with warnings.catch_warnings(record=True):
warnings.simplefilter("ignore", RuntimeWarning)
self.check_funs(nanops.nanmedian, np.median, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=True, allow_obj='convert')
示例2: test_cython_median
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nanmedian [as 别名]
def test_cython_median():
df = DataFrame(np.random.randn(1000))
df.values[::2] = np.nan
labels = np.random.randint(0, 50, size=1000).astype(float)
labels[::17] = np.nan
result = df.groupby(labels).median()
exp = df.groupby(labels).agg(nanops.nanmedian)
tm.assert_frame_equal(result, exp)
df = DataFrame(np.random.randn(1000, 5))
rs = df.groupby(labels).agg(np.median)
xp = df.groupby(labels).median()
tm.assert_frame_equal(rs, xp)
示例3: median
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nanmedian [as 别名]
def median(self, axis=None, out=None, overwrite_input=False,
keepdims=False, skipna=True):
nv.validate_median((), dict(out=out, overwrite_input=overwrite_input,
keepdims=keepdims))
return nanops.nanmedian(self._ndarray, axis=axis, skipna=skipna)
示例4: test_nanmedian
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nanmedian [as 别名]
def test_nanmedian(self):
with warnings.catch_warnings(record=True):
self.check_funs(nanops.nanmedian, np.median, allow_complex=False,
allow_str=False, allow_date=False,
allow_tdelta=True, allow_obj='convert')
示例5: test_cython_median
# 需要导入模块: from pandas.core import nanops [as 别名]
# 或者: from pandas.core.nanops import nanmedian [as 别名]
def test_cython_median(self):
df = DataFrame(np.random.randn(1000))
df.values[::2] = np.nan
labels = np.random.randint(0, 50, size=1000).astype(float)
labels[::17] = np.nan
result = df.groupby(labels).median()
exp = df.groupby(labels).agg(nanops.nanmedian)
assert_frame_equal(result, exp)
df = DataFrame(np.random.randn(1000, 5))
rs = df.groupby(labels).agg(np.median)
xp = df.groupby(labels).median()
assert_frame_equal(rs, xp)