@@ -460,10 +460,6 @@ def __mul__(self, other):
460
460
if not hasattr (other , "dtype" ):
461
461
# list, tuple
462
462
other = np .array (other )
463
- if len (other ) != len (self ) and not is_timedelta64_dtype (other ):
464
- # Exclude timedelta64 here so we correctly raise TypeError
465
- # for that instead of ValueError
466
- raise ValueError ("Cannot multiply with unequal lengths" )
467
463
468
464
if is_object_dtype (other .dtype ):
469
465
# this multiplication will succeed only if all elements of other
@@ -507,10 +503,7 @@ def __truediv__(self, other):
507
503
# e.g. list, tuple
508
504
other = np .array (other )
509
505
510
- if len (other ) != len (self ):
511
- raise ValueError ("Cannot divide vectors with unequal lengths" )
512
-
513
- elif is_timedelta64_dtype (other .dtype ):
506
+ if is_timedelta64_dtype (other .dtype ):
514
507
# let numpy handle it
515
508
return self ._data / other
516
509
@@ -560,10 +553,7 @@ def __rtruediv__(self, other):
560
553
# e.g. list, tuple
561
554
other = np .array (other )
562
555
563
- if len (other ) != len (self ):
564
- raise ValueError ("Cannot divide vectors with unequal lengths" )
565
-
566
- elif is_timedelta64_dtype (other .dtype ):
556
+ if is_timedelta64_dtype (other .dtype ):
567
557
# let numpy handle it
568
558
return other / self ._data
569
559
@@ -612,10 +602,8 @@ def __floordiv__(self, other):
612
602
if not hasattr (other , "dtype" ):
613
603
# list, tuple
614
604
other = np .array (other )
615
- if len (other ) != len (self ):
616
- raise ValueError ("Cannot divide with unequal lengths" )
617
605
618
- elif is_timedelta64_dtype (other .dtype ):
606
+ if is_timedelta64_dtype (other .dtype ):
619
607
other = type (self )(other )
620
608
621
609
# numpy timedelta64 does not natively support floordiv, so operate
@@ -666,10 +654,8 @@ def __rfloordiv__(self, other):
666
654
if not hasattr (other , "dtype" ):
667
655
# list, tuple
668
656
other = np .array (other )
669
- if len (other ) != len (self ):
670
- raise ValueError ("Cannot divide with unequal lengths" )
671
657
672
- elif is_timedelta64_dtype (other .dtype ):
658
+ if is_timedelta64_dtype (other .dtype ):
673
659
other = type (self )(other )
674
660
675
661
# numpy timedelta64 does not natively support floordiv, so operate
0 commit comments