File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1025,8 +1025,22 @@ def __neg__(self):
1025
1025
values = com ._values_from_object (self )
1026
1026
if values .dtype == np .bool_ :
1027
1027
arr = operator .inv (values )
1028
- else :
1028
+ elif ( is_numeric_dtype ( values ) or is_timedelta64_dtype ( values )) :
1029
1029
arr = operator .neg (values )
1030
+ else :
1031
+ raise TypeError ("Unary negative expects numeric dtype, not {}"
1032
+ .format (values .dtype ))
1033
+ return self .__array_wrap__ (arr )
1034
+
1035
+ def __pos__ (self ):
1036
+ values = _values_from_object (self )
1037
+ if values .dtype == np .bool_ :
1038
+ arr = values
1039
+ elif (is_numeric_dtype (values ) or is_timedelta64_dtype (values )):
1040
+ arr = operator .pos (values )
1041
+ else :
1042
+ raise TypeError ("Unary plus expects numeric dtype, not {}"
1043
+ .format (values .dtype ))
1030
1044
return self .__array_wrap__ (arr )
1031
1045
1032
1046
def __invert__ (self ):
You can’t perform that action at this time.
0 commit comments