@@ -289,7 +289,7 @@ def test_margin_dropna4(self):
289289 # GH: 10772: Keep np.nan in result with dropna=False
290290 df = DataFrame ({"a" : [1 , 2 , 2 , 2 , 2 , np .nan ], "b" : [3 , 3 , 4 , 4 , 4 , 4 ]})
291291 actual = crosstab (df .a , df .b , margins = True , dropna = False )
292- expected = DataFrame ([[1 , 0 , 1.0 ], [1 , 3 , 4.0 ], [0 , 1 , np . nan ], [2 , 4 , 6.0 ]])
292+ expected = DataFrame ([[1 , 0 , 1 ], [1 , 3 , 4 ], [0 , 1 , 1 ], [2 , 4 , 6 ]])
293293 expected .index = Index ([1.0 , 2.0 , np .nan , "All" ], name = "a" )
294294 expected .columns = Index ([3 , 4 , "All" ], name = "b" )
295295 tm .assert_frame_equal (actual , expected )
@@ -301,11 +301,11 @@ def test_margin_dropna5(self):
301301 )
302302 actual = crosstab (df .a , df .b , margins = True , dropna = False )
303303 expected = DataFrame (
304- [[1 , 0 , 0 , 1.0 ], [0 , 1 , 0 , 1.0 ], [0 , 3 , 1 , np . nan ], [1 , 4 , 0 , 6.0 ]]
304+ [[1 , 0 , 0 , 1.0 ], [0 , 1 , 0 , 1.0 ], [0 , 3 , 1 , 4.0 ], [1 , 4 , 1 , 6.0 ]]
305305 )
306306 expected .index = Index ([1.0 , 2.0 , np .nan , "All" ], name = "a" )
307307 expected .columns = Index ([3.0 , 4.0 , np .nan , "All" ], name = "b" )
308- tm .assert_frame_equal (actual , expected )
308+ tm .assert_frame_equal (actual , expected , check_dtype = False )
309309
310310 def test_margin_dropna6 (self ):
311311 # GH: 10772: Keep np.nan in result with dropna=False
@@ -326,7 +326,7 @@ def test_margin_dropna6(self):
326326 names = ["b" , "c" ],
327327 )
328328 expected = DataFrame (
329- [[1 , 0 , 1 , 0 , 0 , 0 , 2 ], [2 , 0 , 1 , 1 , 0 , 1 , 5 ], [3 , 0 , 2 , 1 , 0 , 0 , 7 ]],
329+ [[1 , 0 , 1 , 0 , 0 , 0 , 2 ], [2 , 0 , 1 , 1 , 0 , 1 , 5 ], [3 , 0 , 2 , 1 , 0 , 1 , 7 ]],
330330 columns = m ,
331331 )
332332 expected .index = Index (["bar" , "foo" , "All" ], name = "a" )
@@ -344,13 +344,13 @@ def test_margin_dropna6(self):
344344 )
345345 expected = DataFrame (
346346 [
347- [1 , 0 , 1.0 ],
348- [1 , 0 , 1.0 ],
347+ [1 , 0 , 1 ],
348+ [1 , 0 , 1 ],
349349 [0 , 0 , np .nan ],
350- [2 , 0 , 2.0 ],
351- [1 , 1 , 2.0 ],
352- [0 , 1 , np . nan ],
353- [5 , 2 , 7.0 ],
350+ [2 , 0 , 2 ],
351+ [1 , 1 , 2 ],
352+ [0 , 1 , 1 ],
353+ [5 , 2 , 7 ],
354354 ],
355355 index = m ,
356356 )
0 commit comments