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 @@ -1029,8 +1029,22 @@ def __neg__(self):
1029
1029
values = com ._values_from_object (self )
1030
1030
if values .dtype == np .bool_ :
1031
1031
arr = operator .inv (values )
1032
- else :
1032
+ elif ( is_numeric_dtype ( values ) or is_timedelta64_dtype ( values )) :
1033
1033
arr = operator .neg (values )
1034
+ else :
1035
+ raise TypeError ("Unary negative expects numeric dtype, not {}"
1036
+ .format (values .dtype ))
1037
+ return self .__array_wrap__ (arr )
1038
+
1039
+ def __pos__ (self ):
1040
+ values = _values_from_object (self )
1041
+ if values .dtype == np .bool_ :
1042
+ arr = values
1043
+ elif (is_numeric_dtype (values ) or is_timedelta64_dtype (values )):
1044
+ arr = operator .pos (values )
1045
+ else :
1046
+ raise TypeError ("Unary plus expects numeric dtype, not {}"
1047
+ .format (values .dtype ))
1034
1048
return self .__array_wrap__ (arr )
1035
1049
1036
1050
def __invert__ (self ):
You can’t perform that action at this time.
0 commit comments