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


Python index.Index類代碼示例

本文整理匯總了Python中pandas.tseries.index.Index的典型用法代碼示例。如果您正苦於以下問題:Python Index類的具體用法?Python Index怎麽用?Python Index使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: get_loc

    def get_loc(self, key, method=None, tolerance=None):
        """
        Get integer location for requested label

        Returns
        -------
        loc : int
        """
        try:
            return self._engine.get_loc(key)
        except KeyError:
            if is_integer(key):
                raise

            try:
                asdt, parsed, reso = parse_time_string(key, self.freq)
                key = asdt
            except TypeError:
                pass

            try:
                key = Period(key, freq=self.freq)
            except ValueError:
                # we cannot construct the Period
                # as we have an invalid type
                raise KeyError(key)

            try:
                ordinal = tslib.iNaT if key is tslib.NaT else key.ordinal
                return Index.get_loc(self, ordinal, method, tolerance)
            except KeyError:
                raise KeyError(key)
開發者ID:DGrady,項目名稱:pandas,代碼行數:32,代碼來源:period.py

示例2: get_loc

    def get_loc(self, key, method=None):
        """
        Get integer location for requested label

        Returns
        -------
        loc : int
        """
        try:
            return self._engine.get_loc(key)
        except KeyError:
            if is_integer(key):
                raise

            try:
                asdt, parsed, reso = parse_time_string(key, self.freq)
                key = asdt
            except TypeError:
                pass

            key = Period(key, self.freq)
            try:
                return Index.get_loc(self, key.ordinal, method=method)
            except KeyError:
                raise KeyError(key)
開發者ID:Arthurkorn,項目名稱:pandas,代碼行數:25,代碼來源:period.py

示例3: get_indexer

    def get_indexer(self, target, method=None, limit=None, tolerance=None):
        target = _ensure_index(target)

        if hasattr(target, 'freq') and target.freq != self.freq:
            msg = _DIFFERENT_FREQ_INDEX.format(self.freqstr, target.freqstr)
            raise IncompatibleFrequency(msg)

        if isinstance(target, PeriodIndex):
            target = target.asi8

        if tolerance is not None:
            tolerance = self._convert_tolerance(tolerance)
        return Index.get_indexer(self._int64index, target, method,
                                 limit, tolerance)
開發者ID:clwater,項目名稱:lesson_python,代碼行數:14,代碼來源:period.py

示例4: get_indexer

 def get_indexer(self, target, method=None, limit=None, tolerance=None):
     if hasattr(target, 'freq') and target.freq != self.freq:
         msg = _DIFFERENT_FREQ_INDEX.format(self.freqstr, target.freqstr)
         raise IncompatibleFrequency(msg)
     return Index.get_indexer(self, target, method, limit, tolerance)
開發者ID:DGrady,項目名稱:pandas,代碼行數:5,代碼來源:period.py

示例5: get_indexer

 def get_indexer(self, target, method=None, limit=None):
     if hasattr(target, 'freq') and target.freq != self.freq:
         raise ValueError('target and index have different freq: '
                          '(%s, %s)' % (target.freq, self.freq))
     return Index.get_indexer(self, target, method, limit)
開發者ID:Arthurkorn,項目名稱:pandas,代碼行數:5,代碼來源:period.py

示例6: get_indexer

 def get_indexer(self, target, method=None, limit=None, tolerance=None):
     if hasattr(target, "freq") and target.freq != self.freq:
         raise ValueError("target and index have different freq: " "(%s, %s)" % (target.freq, self.freq))
     return Index.get_indexer(self, target, method, limit, tolerance)
開發者ID:troglotit,項目名稱:pandas,代碼行數:4,代碼來源:period.py


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