@@ -1370,25 +1370,29 @@ def test_merge_on_indexes(self):
13701370 tm .assert_frame_equal (result , expected )
13711371
13721372 # how='left'
1373- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'left' )
1373+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1374+ how = 'left' )
13741375 expected = pd .DataFrame ({'a' : [20 , 10 , 0 ], 'b' : [200 , 100 , np .nan ]},
13751376 index = [2 , 1 , 0 ])
13761377 tm .assert_frame_equal (result , expected )
13771378
13781379 # how='right'
1379- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'right' )
1380+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1381+ how = 'right' )
13801382 expected = pd .DataFrame ({'a' : [10 , 20 , np .nan ], 'b' : [100 , 200 , 300 ]},
13811383 index = [1 , 2 , 3 ])
13821384 tm .assert_frame_equal (result , expected )
13831385
13841386 # how='inner'
1385- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'inner' )
1387+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1388+ how = 'inner' )
13861389 expected = pd .DataFrame ({'a' : [20 , 10 ], 'b' : [200 , 100 ]},
13871390 index = [2 , 1 ])
13881391 tm .assert_frame_equal (result , expected )
13891392
13901393 # how='outer'
1391- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'outer' )
1394+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1395+ how = 'outer' )
13921396 expected = pd .DataFrame ({'a' : [0 , 10 , 20 , np .nan ],
13931397 'b' : [np .nan , 100 , 200 , 300 ]},
13941398 index = [0 , 1 , 2 , 3 ])
@@ -1399,37 +1403,43 @@ def test_merge_on_indexes_sort(self):
13991403 df2 = pd .DataFrame ({'b' : [100 , 200 , 300 ]}, index = [1 , 2 , 3 ])
14001404
14011405 # default how='inner'
1402- result = pd .merge (df1 , df2 , left_index = True , right_index = True , sort = True )
1406+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1407+ sort = True )
14031408 expected = pd .DataFrame ({'a' : [10 , 20 ], 'b' : [100 , 200 ]},
14041409 index = [1 , 2 ])
14051410 tm .assert_frame_equal (result , expected )
14061411
14071412 # how='left'
1408- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'left' , sort = True )
1413+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1414+ how = 'left' , sort = True )
14091415 expected = pd .DataFrame ({'a' : [0 , 10 , 20 ], 'b' : [np .nan , 100 , 200 ]},
14101416 index = [0 , 1 , 2 ])
14111417 tm .assert_frame_equal (result , expected )
14121418
14131419 # how='right' (already sorted)
1414- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'right' , sort = True )
1420+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1421+ how = 'right' , sort = True )
14151422 expected = pd .DataFrame ({'a' : [10 , 20 , np .nan ], 'b' : [100 , 200 , 300 ]},
14161423 index = [1 , 2 , 3 ])
14171424 tm .assert_frame_equal (result , expected )
14181425
14191426 # how='right'
1420- result = pd .merge (df2 , df1 , left_index = True , right_index = True , how = 'right' , sort = True )
1427+ result = pd .merge (df2 , df1 , left_index = True , right_index = True ,
1428+ how = 'right' , sort = True )
14211429 expected = pd .DataFrame ([[np .nan , 0 ], [100 , 10 ], [200 , 20 ]],
14221430 columns = ['b' , 'a' ], index = [0 , 1 , 2 ])
14231431 tm .assert_frame_equal (result , expected )
14241432
14251433 # how='inner'
1426- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'inner' , sort = True )
1434+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1435+ how = 'inner' , sort = True )
14271436 expected = pd .DataFrame ({'a' : [10 , 20 ], 'b' : [100 , 200 ]},
14281437 index = [1 , 2 ])
14291438 tm .assert_frame_equal (result , expected )
14301439
14311440 # how='outer'
1432- result = pd .merge (df1 , df2 , left_index = True , right_index = True , how = 'outer' , sort = True )
1441+ result = pd .merge (df1 , df2 , left_index = True , right_index = True ,
1442+ how = 'outer' , sort = True )
14331443 expected = pd .DataFrame ({'a' : [0 , 10 , 20 , np .nan ],
14341444 'b' : [np .nan , 100 , 200 , 300 ]},
14351445 index = [0 , 1 , 2 , 3 ])
0 commit comments