本文整理汇总了Python中pandas.tseries.index.Int64Index类的典型用法代码示例。如果您正苦于以下问题:Python Int64Index类的具体用法?Python Int64Index怎么用?Python Int64Index使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Int64Index类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: slice_locs
def slice_locs(self, start=None, end=None):
"""
Index.slice_locs, customized to handle partial ISO-8601 string slicing
"""
if isinstance(start, basestring) or isinstance(end, basestring):
try:
if start:
start_loc = self._get_string_slice(start).start
else:
start_loc = 0
if end:
end_loc = self._get_string_slice(end).stop
else:
end_loc = len(self)
return start_loc, end_loc
except KeyError:
pass
if isinstance(start, datetime) and isinstance(end, datetime):
ordinals = self.values
t1 = Period(start, freq=self.freq)
t2 = Period(end, freq=self.freq)
left = ordinals.searchsorted(t1.ordinal, side='left')
right = ordinals.searchsorted(t2.ordinal, side='right')
return left, right
return Int64Index.slice_locs(self, start, end)
示例2: join
def join(self, other, how="left", level=None, return_indexers=False):
"""
See Index.join
"""
self._assert_can_do_setop(other)
result = Int64Index.join(self, other, how=how, level=level, return_indexers=return_indexers)
if return_indexers:
result, lidx, ridx = result
return self._apply_meta(result), lidx, ridx
return self._apply_meta(result)
示例3: slice_locs
def slice_locs(self, start=None, end=None):
"""
Index.slice_locs, customized to handle partial ISO-8601 string slicing
"""
if isinstance(start, basestring) or isinstance(end, basestring):
try:
if start:
start_loc = self._get_string_slice(start).start
else:
start_loc = 0
if end:
end_loc = self._get_string_slice(end).stop
else:
end_loc = len(self)
return start_loc, end_loc
except KeyError:
pass
return Int64Index.slice_locs(self, start, end)