File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ Bug Fixes
5555
5656- Bug in ``.to_latex()`` output broken when the index has a name (:issue: `10660`)
5757- 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`)
5959
6060
6161
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ def conform(self, rhs):
129129 """ inplace conform rhs """
130130 if not com .is_list_like (rhs ):
131131 rhs = [rhs ]
132- if hasattr ( self . rhs , 'ravel' ):
132+ if isinstance ( rhs , np . ndarray ):
133133 rhs = rhs .ravel ()
134134 return rhs
135135
Original file line number Diff line number Diff line change @@ -3049,6 +3049,18 @@ def test_select_dtypes(self):
30493049 result = store .select (
30503050 'df4' , where = 'values>2.0' )
30513051 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 )
30523064
30533065 def test_select_with_many_inputs (self ):
30543066
You can’t perform that action at this time.
0 commit comments