@@ -1408,10 +1408,12 @@ def test_to_latex_multiindex_multirow(self):
14081408
14091409 def test_to_latex_multiindex_format_single_index_hidden (self ):
14101410 # GH 52218
1411- df = pd .DataFrame ({
1412- "A" : [1 , 2 ],
1413- "B" : [4 , 5 ],
1414- })
1411+ df = DataFrame (
1412+ {
1413+ "A" : [1 , 2 ],
1414+ "B" : [4 , 5 ],
1415+ }
1416+ )
14151417 result = (
14161418 df .style .hide (axis = "index" )
14171419 .map_index (lambda v : "textbf:--rwrap;" , axis = "columns" )
@@ -1423,8 +1425,7 @@ def test_to_latex_multiindex_format_single_index_hidden(self):
14231425 1 & 4 \\
14241426 2 & 5 \\
14251427 \end{tabular}
1426- """
1427- )
1428+ """ )
14281429 assert result == expected
14291430
14301431 def test_to_latex_multiindex_format_triple_index_two_hidden (self ):
@@ -1434,11 +1435,13 @@ def test_to_latex_multiindex_format_triple_index_two_hidden(self):
14341435 ["one" , "two" , "one" , "two" ],
14351436 ["x" , "x" , "y" , "y" ],
14361437 ]
1437- index = pd .MultiIndex .from_arrays (arrays , names = ["Level 0" , "Level 1" , "Level 2" ])
1438- df = pd .DataFrame (
1439- [[0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ]],
1440- index = index ,
1441- columns = ["C1" , "C2" , "C3" ]
1438+ index = pd .MultiIndex .from_arrays (
1439+ arrays , names = ["Level 0" , "Level 1" , "Level 2" ]
1440+ )
1441+ df = DataFrame (
1442+ [[0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ]],
1443+ index = index ,
1444+ columns = ["C1" , "C2" , "C3" ],
14421445 )
14431446 result = (
14441447 df .style .hide (axis = "index" , level = [0 , 1 ])
@@ -1454,8 +1457,7 @@ def test_to_latex_multiindex_format_triple_index_two_hidden(self):
14541457 y & 0 & 0 & 0 \\
14551458 y & 0 & 0 & 0 \\
14561459 \end{tabular}
1457- """
1458- )
1460+ """ )
14591461 assert result == expected
14601462
14611463 def test_to_latex_multiindex_format_triple_index_all_hidden (self ):
@@ -1465,11 +1467,13 @@ def test_to_latex_multiindex_format_triple_index_all_hidden(self):
14651467 ["one" , "two" , "one" , "two" ],
14661468 ["x" , "x" , "y" , "y" ],
14671469 ]
1468- index = pd .MultiIndex .from_arrays (arrays , names = ["Level 0" , "Level 1" , "Level 2" ])
1469- df = pd .DataFrame (
1470- [[0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ]],
1471- index = index ,
1472- columns = ["C1" , "C2" , "C3" ]
1470+ index = pd .MultiIndex .from_arrays (
1471+ arrays , names = ["Level 0" , "Level 1" , "Level 2" ]
1472+ )
1473+ df = DataFrame (
1474+ [[0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ], [0 , 0 , 0 ]],
1475+ index = index ,
1476+ columns = ["C1" , "C2" , "C3" ],
14731477 )
14741478 result = (
14751479 df .style .hide (axis = "index" , level = [0 , 1 , 2 ])
@@ -1484,6 +1488,5 @@ def test_to_latex_multiindex_format_triple_index_all_hidden(self):
14841488 0 & 0 & 0 \\
14851489 0 & 0 & 0 \\
14861490 \end{tabular}
1487- """
1488- )
1491+ """ )
14891492 assert result == expected
0 commit comments