File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -758,3 +758,23 @@ def test_map_with_dict_or_series(self):
758
758
output = cur_index .map (mapper )
759
759
# Order of categories in output can be different
760
760
tm .assert_index_equal (expected , output )
761
+
762
+ def test_operations_with_interval_categories_index (self ):
763
+ ind = pd .CategoricalIndex (pd .interval_range (start = 0.0 , end = 2.0 ))
764
+ df = pd .DataFrame ([[1 , 2 ]], columns = ind )
765
+ # __add__
766
+ result = df + 100
767
+ expected = pd .DataFrame ([[101 , 102 ]], columns = ind )
768
+ tm .assert_frame_equal (result , expected )
769
+ # __substract__
770
+ result = df - 100
771
+ expected = pd .DataFrame ([[- 99 , - 98 ]], columns = ind )
772
+ tm .assert_frame_equal (result , expected )
773
+ # __multiply__
774
+ result = df * 100
775
+ expected = pd .DataFrame ([[100 , 200 ]], columns = ind )
776
+ tm .assert_frame_equal (result , expected )
777
+ # __divide__
778
+ result = df / 100
779
+ expected = pd .DataFrame ([[0.01 , 0.02 ]], columns = ind )
780
+ tm .assert_frame_equal (result , expected )
You can’t perform that action at this time.
0 commit comments