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


Python compat.PYPY属性代码示例

本文整理汇总了Python中pandas.compat.PYPY属性的典型用法代码示例。如果您正苦于以下问题:Python compat.PYPY属性的具体用法?Python compat.PYPY怎么用?Python compat.PYPY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pandas.compat的用法示例。


在下文中一共展示了compat.PYPY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def test_memory_usage(self):
        cat = Categorical([1, 2, 3])

        # .categories is an index, so we include the hashtable
        assert 0 < cat.nbytes <= cat.memory_usage()
        assert 0 < cat.nbytes <= cat.memory_usage(deep=True)

        cat = Categorical(['foo', 'foo', 'bar'])
        assert cat.memory_usage(deep=True) > cat.nbytes

        if not PYPY:
            # sys.getsizeof will call the .memory_usage with
            # deep=True, and add on some GC overhead
            diff = cat.memory_usage(deep=True) - sys.getsizeof(cat)
            assert abs(diff) < 100 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:17,代码来源:test_analytics.py

示例2: memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def memory_usage(self, deep=False):
        """
        Memory usage of the values

        Parameters
        ----------
        deep : bool
            Introspect the data deeply, interrogate
            `object` dtypes for system-level memory consumption

        Returns
        -------
        bytes used

        See Also
        --------
        numpy.ndarray.nbytes

        Notes
        -----
        Memory usage does not include memory consumed by elements that
        are not components of the array if deep=False or if used on PyPy
        """
        if hasattr(self.array, 'memory_usage'):
            return self.array.memory_usage(deep=deep)

        v = self.array.nbytes
        if deep and is_object_dtype(self) and not PYPY:
            v += lib.memory_usage_of_objects(self.array)
        return v 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:32,代码来源:base.py

示例3: memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def memory_usage(self, deep=False):
        values = self.sp_values

        v = values.nbytes

        if deep and is_object_dtype(self) and not PYPY:
            v += lib.memory_usage_of_objects(values)

        return v 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:11,代码来源:array.py

示例4: memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def memory_usage(self, deep=False):
        """
        Memory usage of the values

        Parameters
        ----------
        deep : bool
            Introspect the data deeply, interrogate
            `object` dtypes for system-level memory consumption

        Returns
        -------
        bytes used

        Notes
        -----
        Memory usage does not include memory consumed by elements that
        are not components of the array if deep=False or if used on PyPy

        See Also
        --------
        numpy.ndarray.nbytes
        """
        if hasattr(self.values, 'memory_usage'):
            return self.values.memory_usage(deep=deep)

        v = self.values.nbytes
        if deep and is_object_dtype(self) and not PYPY:
            v += lib.memory_usage_of_objects(self.values)
        return v 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:32,代码来源:base.py

示例5: memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def memory_usage(self, deep=False):
        """
        Memory usage of my values

        Parameters
        ----------
        deep : bool
            Introspect the data deeply, interrogate
            `object` dtypes for system-level memory consumption

        Returns
        -------
        bytes used

        Notes
        -----
        Memory usage does not include memory consumed by elements that
        are not components of the array if deep=False or if used on PyPy

        See Also
        --------
        numpy.ndarray.nbytes
        """
        if hasattr(self.values, 'memory_usage'):
            return self.values.memory_usage(deep=deep)

        v = self.values.nbytes
        if deep and is_object_dtype(self) and not PYPY:
            v += lib.memory_usage_of_objects(self.values)
        return v 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:32,代码来源:base.py

示例6: test_memory_usage

# 需要导入模块: from pandas import compat [as 别名]
# 或者: from pandas.compat import PYPY [as 别名]
def test_memory_usage(self):
        cat = pd.Categorical([1, 2, 3])

        # .categories is an index, so we include the hashtable
        assert 0 < cat.nbytes <= cat.memory_usage()
        assert 0 < cat.nbytes <= cat.memory_usage(deep=True)

        cat = pd.Categorical(['foo', 'foo', 'bar'])
        assert cat.memory_usage(deep=True) > cat.nbytes

        if not PYPY:
            # sys.getsizeof will call the .memory_usage with
            # deep=True, and add on some GC overhead
            diff = cat.memory_usage(deep=True) - sys.getsizeof(cat)
            assert abs(diff) < 100 
开发者ID:securityclippy,项目名称:elasticintel,代码行数:17,代码来源:test_categorical.py


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