File tree 3 files changed +14
-2
lines changed
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ Bug Fixes
55
55
56
56
- Bug in ``.to_latex()`` output broken when the index has a name (:issue: `10660`)
57
57
- Bug in ``HDFStore.append`` with strings whose encoded length exceded the max unencoded length (:issue:`11234`)
58
-
58
+ - Bug in ``HDFStore.select`` when comparing with a numpy scalar in a where clause (:issue:`11283`)
59
59
60
60
61
61
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ def conform(self, rhs):
129
129
""" inplace conform rhs """
130
130
if not com .is_list_like (rhs ):
131
131
rhs = [rhs ]
132
- if hasattr ( self . rhs , 'ravel' ):
132
+ if isinstance ( rhs , np . ndarray ):
133
133
rhs = rhs .ravel ()
134
134
return rhs
135
135
Original file line number Diff line number Diff line change @@ -3049,6 +3049,18 @@ def test_select_dtypes(self):
3049
3049
result = store .select (
3050
3050
'df4' , where = 'values>2.0' )
3051
3051
tm .assert_frame_equal (expected , result )
3052
+
3053
+ # test selection with comparison against numpy scalar
3054
+ # GH 11283
3055
+ with ensure_clean_store (self .path ) as store :
3056
+ df = tm .makeDataFrame ()
3057
+
3058
+ expected = df [df ['A' ]> 0 ]
3059
+
3060
+ store .append ('df' , df , data_columns = True )
3061
+ np_zero = np .float64 (0 )
3062
+ result = store .select ('df' , where = ["A>np_zero" ])
3063
+ tm .assert_frame_equal (expected , result )
3052
3064
3053
3065
def test_select_with_many_inputs (self ):
3054
3066
You can’t perform that action at this time.
0 commit comments