@@ -553,7 +553,7 @@ def __mul__(self, other):
553
553
# for that instead of ValueError
554
554
raise ValueError ("Cannot multiply with unequal lengths" )
555
555
556
- if is_object_dtype (other ):
556
+ if is_object_dtype (other . dtype ):
557
557
# this multiplication will succeed only if all elements of other
558
558
# are int or float scalars, so we will end up with
559
559
# timedelta64[ns]-dtyped result
@@ -601,11 +601,11 @@ def __truediv__(self, other):
601
601
if len (other ) != len (self ):
602
602
raise ValueError ("Cannot divide vectors with unequal lengths" )
603
603
604
- elif is_timedelta64_dtype (other ):
604
+ elif is_timedelta64_dtype (other . dtype ):
605
605
# let numpy handle it
606
606
return self ._data / other
607
607
608
- elif is_object_dtype (other ):
608
+ elif is_object_dtype (other . dtype ):
609
609
# Note: we do not do type inference on the result, so either
610
610
# an object array or numeric-dtyped (if numpy does inference)
611
611
# will be returned. GH#23829
@@ -649,12 +649,12 @@ def __rtruediv__(self, other):
649
649
if len (other ) != len (self ):
650
650
raise ValueError ("Cannot divide vectors with unequal lengths" )
651
651
652
- elif is_timedelta64_dtype (other ):
652
+ elif is_timedelta64_dtype (other . dtype ):
653
653
# let numpy handle it
654
654
return other / self ._data
655
655
656
- elif is_object_dtype (other ):
657
- # Note: unlike in __truediv__, we do not _need_ to do type#
656
+ elif is_object_dtype (other . dtype ):
657
+ # Note: unlike in __truediv__, we do not _need_ to do type
658
658
# inference on the result. It does not raise, a numeric array
659
659
# is returned. GH#23829
660
660
result = [other [n ] / self [n ] for n in range (len (self ))]
@@ -701,7 +701,7 @@ def __floordiv__(self, other):
701
701
if len (other ) != len (self ):
702
702
raise ValueError ("Cannot divide with unequal lengths" )
703
703
704
- elif is_timedelta64_dtype (other ):
704
+ elif is_timedelta64_dtype (other . dtype ):
705
705
other = type (self )(other )
706
706
707
707
# numpy timedelta64 does not natively support floordiv, so operate
@@ -713,15 +713,15 @@ def __floordiv__(self, other):
713
713
result [mask ] = np .nan
714
714
return result
715
715
716
- elif is_object_dtype (other ):
716
+ elif is_object_dtype (other . dtype ):
717
717
result = [self [n ] // other [n ] for n in range (len (self ))]
718
718
result = np .array (result )
719
719
if lib .infer_dtype (result , skipna = False ) == "timedelta" :
720
720
result , _ = sequence_to_td64ns (result )
721
721
return type (self )(result )
722
722
return result
723
723
724
- elif is_integer_dtype (other ) or is_float_dtype (other ):
724
+ elif is_integer_dtype (other . dtype ) or is_float_dtype (other . dtype ):
725
725
result = self ._data // other
726
726
return type (self )(result )
727
727
@@ -763,7 +763,7 @@ def __rfloordiv__(self, other):
763
763
if len (other ) != len (self ):
764
764
raise ValueError ("Cannot divide with unequal lengths" )
765
765
766
- elif is_timedelta64_dtype (other ):
766
+ elif is_timedelta64_dtype (other . dtype ):
767
767
other = type (self )(other )
768
768
769
769
# numpy timedelta64 does not natively support floordiv, so operate
@@ -775,7 +775,7 @@ def __rfloordiv__(self, other):
775
775
result [mask ] = np .nan
776
776
return result
777
777
778
- elif is_object_dtype (other ):
778
+ elif is_object_dtype (other . dtype ):
779
779
result = [other [n ] // self [n ] for n in range (len (self ))]
780
780
result = np .array (result )
781
781
return result
0 commit comments