@@ -248,16 +248,22 @@ def test_getitem_boolean_casting(self):
248248 df = self .tsframe .copy ()
249249 df ['E' ] = 1
250250 df ['E' ] = df ['E' ].astype ('int32' )
251+ df ['E1' ] = df ['E' ].copy ()
251252 df ['F' ] = 1
252253 df ['F' ] = df ['F' ].astype ('int64' )
254+ df ['F1' ] = df ['F' ].copy ()
255+
253256 casted = df [df > 0 ]
254257 result = casted .get_dtype_counts ()
255- expected = Series ({'float64' : 4 , 'int32' : 1 , 'int64' : 1 })
256-
257- ### when we always cast here's the result ###
258- #expected = Series({'float64': 6 })
258+ expected = Series ({'float64' : 4 , 'int32' : 2 , 'int64' : 2 })
259259 assert_series_equal (result , expected )
260260
261+ # int block splitting
262+ df .ix [1 :3 ,['E1' ,'F1' ]] = 0
263+ casted = df [df > 0 ]
264+ result = casted .get_dtype_counts ()
265+ expected = Series ({'float64' : 6 , 'int32' : 1 , 'int64' : 1 })
266+ assert_series_equal (result , expected )
261267
262268 def test_getitem_boolean_list (self ):
263269 df = DataFrame (np .arange (12 ).reshape (3 , 4 ))
@@ -6031,6 +6037,7 @@ def _check_align(df, cond, other, check_dtypes = True):
60316037
60326038 # dtypes
60336039 # can't check dtype when other is an ndarray
6040+
60346041 if check_dtypes and not isinstance (other ,np .ndarray ):
60356042 self .assert_ ((rs .dtypes == df .dtypes ).all () == True )
60366043
@@ -6066,13 +6073,15 @@ def _check_set(df, cond, check_dtypes = True):
60666073 dfi = df .copy ()
60676074 econd = cond .reindex_like (df ).fillna (True )
60686075 expected = dfi .mask (~ econd )
6076+
6077+ #import pdb; pdb.set_trace()
60696078 dfi .where (cond , np .nan , inplace = True )
60706079 assert_frame_equal (dfi , expected )
60716080
60726081 # dtypes (and confirm upcasts)x
60736082 if check_dtypes :
60746083 for k , v in df .dtypes .iteritems ():
6075- if issubclass (v .type ,np .integer ):
6084+ if issubclass (v .type ,np .integer ) and not cond [ k ]. all () :
60766085 v = np .dtype ('float64' )
60776086 self .assert_ (dfi [k ].dtype == v )
60786087
0 commit comments