本文整理匯總了Python中pandas.compat.get_range_parameters方法的典型用法代碼示例。如果您正苦於以下問題:Python compat.get_range_parameters方法的具體用法?Python compat.get_range_parameters怎麽用?Python compat.get_range_parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.compat
的用法示例。
在下文中一共展示了compat.get_range_parameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: from_range
# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import get_range_parameters [as 別名]
def from_range(cls, data, name=None, dtype=None, **kwargs):
""" Create RangeIndex from a range (py3), or xrange (py2) object. """
if not isinstance(data, range):
raise TypeError(
'{0}(...) must be called with object coercible to a '
'range, {1} was passed'.format(cls.__name__, repr(data)))
start, stop, step = get_range_parameters(data)
return RangeIndex(start, stop, step, dtype=dtype, name=name, **kwargs)
示例2: from_range
# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import get_range_parameters [as 別名]
def from_range(cls, data, name=None, dtype=None, **kwargs):
""" create RangeIndex from a range (py3), or xrange (py2) object """
if not isinstance(data, range):
raise TypeError(
'{0}(...) must be called with object coercible to a '
'range, {1} was passed'.format(cls.__name__, repr(data)))
start, stop, step = get_range_parameters(data)
return RangeIndex(start, stop, step, dtype=dtype, name=name, **kwargs)