File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 17
17
CategoricalDtype ,
18
18
DataFrame ,
19
19
Index ,
20
+ Interval ,
20
21
NaT ,
21
22
Series ,
22
23
array ,
@@ -1092,6 +1093,23 @@ def test_iloc_getitem_with_duplicates2(self):
1092
1093
expected = df .take ([0 ], axis = 1 )
1093
1094
tm .assert_frame_equal (result , expected )
1094
1095
1096
+ def test_iloc_interval (self ):
1097
+ # GH#17130
1098
+ df = DataFrame ({Interval (1 , 2 ): [1 , 2 ]})
1099
+
1100
+ result = df .iloc [0 ]
1101
+ expected = Series ({Interval (1 , 2 ): 1 }, name = 0 )
1102
+ tm .assert_series_equal (result , expected )
1103
+
1104
+ result = df .iloc [:, 0 ]
1105
+ expected = Series ([1 , 2 ], name = Interval (1 , 2 ))
1106
+ tm .assert_series_equal (result , expected )
1107
+
1108
+ result = df .copy ()
1109
+ result .iloc [:, 0 ] += 1
1110
+ expected = DataFrame ({Interval (1 , 2 ): [2 , 3 ]})
1111
+ tm .assert_frame_equal (result , expected )
1112
+
1095
1113
1096
1114
class TestILocErrors :
1097
1115
# NB: this test should work for _any_ Series we can pass as
You can’t perform that action at this time.
0 commit comments