예제 #1
0
def test_from_tuples_deprecation_error():
    # GH#40245
    msg = "Can only specify 'closed' or 'inclusive', not both."
    with pytest.raises(TypeError, match=msg):
        with tm.assert_produces_warning(FutureWarning):
            IntervalArray.from_tuples([(0, 1), (1, 2)],
                                      closed="right",
                                      inclusive="right")
예제 #2
0
 def test_shift(self):
     # https://github.com/pandas-dev/pandas/issues/31495, GH#22428, GH#31502
     a = IntervalArray.from_breaks([1, 2, 3])
     result = a.shift()
     # int -> float
     expected = IntervalArray.from_tuples([(np.nan, np.nan), (1.0, 2.0)])
     tm.assert_interval_array_equal(result, expected)
예제 #3
0
def test_repr():
    # GH 25022
    arr = IntervalArray.from_tuples([(0, 1), (1, 2)])
    result = repr(arr)
    expected = ("<IntervalArray>\n"
                "[(0, 1], (1, 2]]\n"
                "Length: 2, dtype: interval[int64, right]")
    assert result == expected
예제 #4
0
def data_for_grouping():
    a = (0, 1)
    b = (1, 2)
    c = (2, 3)
    return IntervalArray.from_tuples([b, b, None, None, a, a, b, c])
예제 #5
0
def data_missing_for_sorting():
    return IntervalArray.from_tuples([(1, 2), None, (0, 1)])
예제 #6
0
def data_for_sorting():
    return IntervalArray.from_tuples([(1, 2), (2, 3), (0, 1)])
예제 #7
0
def data_missing():
    """Length 2 array with [NA, Valid]"""
    return IntervalArray.from_tuples([None, (0, 1)])
예제 #8
0
def data_for_grouping():
    a = (0, 1)
    b = (1, 2)
    c = (2, 3)
    return IntervalArray.from_tuples([b, b, None, None, a, a, b, c])
예제 #9
0
def data_missing_for_sorting():
    return IntervalArray.from_tuples([(1, 2), None, (0, 1)])
예제 #10
0
def data_for_sorting():
    return IntervalArray.from_tuples([(1, 2), (2, 3), (0, 1)])
예제 #11
0
def data_missing():
    """Length 2 array with [NA, Valid]"""
    return IntervalArray.from_tuples([None, (0, 1)])
예제 #12
0
def test_from_tuples_deprecation():
    # GH#40245
    with tm.assert_produces_warning(FutureWarning):
        IntervalArray.from_tuples([(0, 1), (1, 2)], closed="right")