當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。