@@ -602,10 +602,9 @@ def _validate_listlike(self, value, allow_object: bool = False):
602
602
pass
603
603
604
604
elif not type (self )._is_recognized_dtype (value .dtype ):
605
- raise TypeError (
606
- f"value should be a '{ self ._scalar_type .__name__ } ', 'NaT', "
607
- f"or array of those. Got '{ type (value ).__name__ } ' instead."
608
- )
605
+ msg = self ._validation_error_message (value , True )
606
+ raise TypeError (msg )
607
+
609
608
return value
610
609
611
610
def _validate_searchsorted_value (self , value ):
@@ -624,19 +623,13 @@ def _validate_setitem_value(self, value):
624
623
625
624
return self ._unbox (value , setitem = True )
626
625
626
+ _validate_where_value = _validate_setitem_value
627
+
627
628
def _validate_insert_value (self , value ):
628
629
value = self ._validate_scalar (value )
629
630
630
631
return self ._unbox (value , setitem = True )
631
632
632
- def _validate_where_value (self , other ):
633
- if not is_list_like (other ):
634
- other = self ._validate_scalar (other , True )
635
- else :
636
- other = self ._validate_listlike (other )
637
-
638
- return self ._unbox (other , setitem = True )
639
-
640
633
def _unbox (
641
634
self , other , setitem : bool = False
642
635
) -> Union [np .int64 , np .datetime64 , np .timedelta64 , np .ndarray ]:
0 commit comments