@@ -32,8 +32,9 @@ def test_simple():
32
32
tm .assert_numpy_array_equal (result , expected , check_dtype = False )
33
33
34
34
35
- def test_bins ():
36
- data = np .array ([0.2 , 1.4 , 2.5 , 6.2 , 9.7 , 2.1 ])
35
+ @pytest .mark .parametrize ("func" , [list , np .array ])
36
+ def test_bins (func ):
37
+ data = func ([0.2 , 1.4 , 2.5 , 6.2 , 9.7 , 2.1 ])
37
38
result , bins = cut (data , 3 , retbins = True )
38
39
39
40
intervals = IntervalIndex .from_breaks (bins .round (3 ))
@@ -68,18 +69,6 @@ def test_no_right():
68
69
tm .assert_almost_equal (bins , np .array ([0.2 , 2.575 , 4.95 , 7.325 , 9.7095 ]))
69
70
70
71
71
- def test_array_like ():
72
- data = [0.2 , 1.4 , 2.5 , 6.2 , 9.7 , 2.1 ]
73
- result , bins = cut (data , 3 , retbins = True )
74
-
75
- intervals = IntervalIndex .from_breaks (bins .round (3 ))
76
- intervals = intervals .take ([0 , 0 , 0 , 1 , 2 , 0 ])
77
- expected = Categorical (intervals , ordered = True )
78
-
79
- tm .assert_categorical_equal (result , expected )
80
- tm .assert_almost_equal (bins , np .array ([0.1905 , 3.36666667 , 6.53333333 , 9.7 ]))
81
-
82
-
83
72
def test_bins_from_interval_index ():
84
73
c = cut (range (5 ), 3 )
85
74
expected = c
0 commit comments