當前位置: 首頁>>代碼示例>>Python>>正文


Python compat.DeepChainMap方法代碼示例

本文整理匯總了Python中pandas.compat.DeepChainMap方法的典型用法代碼示例。如果您正苦於以下問題:Python compat.DeepChainMap方法的具體用法?Python compat.DeepChainMap怎麽用?Python compat.DeepChainMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.compat的用法示例。


在下文中一共展示了compat.DeepChainMap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import DeepChainMap [as 別名]
def __init__(self, where, queryables=None, encoding=None, scope_level=0):

        where = _validate_where(where)

        self.encoding = encoding
        self.condition = None
        self.filter = None
        self.terms = None
        self._visitor = None

        # capture the environment if needed
        local_dict = DeepChainMap()

        if isinstance(where, Expr):
            local_dict = where.env.scope
            where = where.expr

        elif isinstance(where, (list, tuple)):
            for idx, w in enumerate(where):
                if isinstance(w, Expr):
                    local_dict = w.env.scope
                else:
                    w = _validate_where(w)
                    where[idx] = w
            where = ' & '.join(map('({})'.format, com.flatten(where)))  # noqa

        self.expr = where
        self.env = Scope(scope_level + 1, local_dict=local_dict)

        if queryables is not None and isinstance(self.expr, string_types):
            self.env.queryables.update(queryables)
            self._visitor = ExprVisitor(self.env, queryables=queryables,
                                        parser='pytables', engine='pytables',
                                        encoding=encoding)
            self.terms = self.parse() 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:37,代碼來源:pytables.py

示例2: __init__

# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import DeepChainMap [as 別名]
def __init__(self, level, global_dict=None, local_dict=None, resolvers=(),
                 target=None):
        self.level = level + 1

        # shallow copy because we don't want to keep filling this up with what
        # was there before if there are multiple calls to Scope/_ensure_scope
        self.scope = DeepChainMap(_DEFAULT_GLOBALS.copy())
        self.target = target

        if isinstance(local_dict, Scope):
            self.scope.update(local_dict.scope)
            if local_dict.target is not None:
                self.target = local_dict.target
            self.update(local_dict.level)

        frame = sys._getframe(self.level)

        try:
            # shallow copy here because we don't want to replace what's in
            # scope when we align terms (alignment accesses the underlying
            # numpy array of pandas objects)
            self.scope = self.scope.new_child((global_dict or
                                               frame.f_globals).copy())
            if not isinstance(local_dict, Scope):
                self.scope = self.scope.new_child((local_dict or
                                                   frame.f_locals).copy())
        finally:
            del frame

        # assumes that resolvers are going from outermost scope to inner
        if isinstance(local_dict, Scope):
            resolvers += tuple(local_dict.resolvers.maps)
        self.resolvers = DeepChainMap(*resolvers)
        self.temps = {} 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:36,代碼來源:scope.py

示例3: full_scope

# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import DeepChainMap [as 別名]
def full_scope(self):
        """Return the full scope for use with passing to engines transparently
        as a mapping.

        Returns
        -------
        vars : DeepChainMap
            All variables in this scope.
        """
        maps = [self.temps] + self.resolvers.maps + self.scope.maps
        return DeepChainMap(*maps) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:13,代碼來源:scope.py


注:本文中的pandas.compat.DeepChainMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。