本文整理匯總了Python中pandas.core.arrays.IntervalArray.from_arrays方法的典型用法代碼示例。如果您正苦於以下問題:Python IntervalArray.from_arrays方法的具體用法?Python IntervalArray.from_arrays怎麽用?Python IntervalArray.from_arrays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.core.arrays.IntervalArray
的用法示例。
在下文中一共展示了IntervalArray.from_arrays方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_na
# 需要導入模塊: from pandas.core.arrays import IntervalArray [as 別名]
# 或者: from pandas.core.arrays.IntervalArray import from_arrays [as 別名]
def test_set_na(self, left_right_dtypes):
left, right = left_right_dtypes
result = IntervalArray.from_arrays(left, right)
result[0] = np.nan
expected_left = Index([left._na_value] + list(left[1:]))
expected_right = Index([right._na_value] + list(right[1:]))
expected = IntervalArray.from_arrays(expected_left, expected_right)
tm.assert_extension_array_equal(result, expected)
示例2: test_repeat
# 需要導入模塊: from pandas.core.arrays import IntervalArray [as 別名]
# 或者: from pandas.core.arrays.IntervalArray import from_arrays [as 別名]
def test_repeat(self, left_right_dtypes, repeats):
left, right = left_right_dtypes
result = IntervalArray.from_arrays(left, right).repeat(repeats)
expected = IntervalArray.from_arrays(
left.repeat(repeats), right.repeat(repeats))
tm.assert_extension_array_equal(result, expected)