当前位置: 首页>>代码示例>>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;未经允许,请勿转载。