@@ -6662,19 +6662,20 @@ def _logical_method(self, other, op):
66626662 return self ._construct_result (res_values , name = res_name , other = other )
66636663
66646664 def _arith_method (self , other , op ):
6665- if (
6666- isinstance (self .index , MultiIndex )
6667- and isinstance (other .index , MultiIndex )
6668- and self .index .names != other .index .names
6669- ):
6670- # GH#25891
6671- warnings .warn (
6672- "The silent alignment on arithmetic operations between "
6673- "'Series' with non-aligned MultiIndexes will be removed "
6674- "in a future version, please use aligned MultiIndexes." ,
6675- Pandas4Warning ,
6676- stacklevel = find_stack_level (),
6677- )
6665+ if isinstance (other , Series ):
6666+ if (
6667+ isinstance (self .index , MultiIndex )
6668+ and isinstance (other .index , MultiIndex )
6669+ and self .index .names != other .index .names
6670+ ):
6671+ # GH#25891
6672+ warnings .warn (
6673+ "The silent alignment on arithmetic operations between "
6674+ "'Series' with non-aligned MultiIndexes will be removed "
6675+ "in a future version, please align MultiIndexes." ,
6676+ Pandas4Warning ,
6677+ stacklevel = find_stack_level (),
6678+ )
66786679
66796680 self , other = self ._align_for_op (other )
66806681 return base .IndexOpsMixin ._arith_method (self , other , op )
0 commit comments