We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a39bcb5 commit c2293beCopy full SHA for c2293be
pandas/tests/frame/test_arithmetic.py
@@ -642,3 +642,14 @@ def test_arith_non_pandas_object(self):
642
val3 = np.random.rand(*df.shape)
643
added = pd.DataFrame(df.values + val3, index=df.index, columns=df.columns)
644
tm.assert_frame_equal(df.add(val3), added)
645
+
646
+ def test_operations_with_interval_categories_index(self, all_arithmetic_operators):
647
+ # GH#27415
648
+ op = all_arithmetic_operators
649
+ ind = pd.CategoricalIndex(pd.interval_range(start=0.0, end=2.0))
650
+ data = [1, 2]
651
+ df = pd.DataFrame([data], columns=ind)
652
+ num = 10
653
+ result = getattr(df, op)(num)
654
+ expected = pd.DataFrame([[getattr(n, op)(num) for n in data]], columns=ind)
655
+ tm.assert_frame_equal(result, expected)
0 commit comments