Skip to content

Commit

Permalink
fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanvilla committed Nov 18, 2024
1 parent bfeb247 commit eb03762
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions pandas/tests/io/formats/test_to_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,10 +1408,12 @@ def test_to_latex_multiindex_multirow(self):

def test_to_latex_multiindex_format_single_index_hidden(self):
# GH 52218
df = pd.DataFrame({
"A": [1, 2],
"B": [4, 5],
})
df = DataFrame(
{
"A": [1, 2],
"B": [4, 5],
}
)
result = (
df.style.hide(axis="index")
.map_index(lambda v: "textbf:--rwrap;", axis="columns")
Expand All @@ -1423,8 +1425,7 @@ def test_to_latex_multiindex_format_single_index_hidden(self):
1 & 4 \\
2 & 5 \\
\end{tabular}
"""
)
""")
assert result == expected

def test_to_latex_multiindex_format_triple_index_two_hidden(self):
Expand All @@ -1434,11 +1435,13 @@ def test_to_latex_multiindex_format_triple_index_two_hidden(self):
["one", "two", "one", "two"],
["x", "x", "y", "y"],
]
index = pd.MultiIndex.from_arrays(arrays, names=["Level 0", "Level 1", "Level 2"])
df = pd.DataFrame(
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
index=index,
columns=["C1", "C2", "C3"]
index = pd.MultiIndex.from_arrays(
arrays, names=["Level 0", "Level 1", "Level 2"]
)
df = DataFrame(
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
index=index,
columns=["C1", "C2", "C3"],
)
result = (
df.style.hide(axis="index", level=[0, 1])
Expand All @@ -1454,8 +1457,7 @@ def test_to_latex_multiindex_format_triple_index_two_hidden(self):
y & 0 & 0 & 0 \\
y & 0 & 0 & 0 \\
\end{tabular}
"""
)
""")
assert result == expected

def test_to_latex_multiindex_format_triple_index_all_hidden(self):
Expand All @@ -1465,11 +1467,13 @@ def test_to_latex_multiindex_format_triple_index_all_hidden(self):
["one", "two", "one", "two"],
["x", "x", "y", "y"],
]
index = pd.MultiIndex.from_arrays(arrays, names=["Level 0", "Level 1", "Level 2"])
df = pd.DataFrame(
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
index=index,
columns=["C1", "C2", "C3"]
index = pd.MultiIndex.from_arrays(
arrays, names=["Level 0", "Level 1", "Level 2"]
)
df = DataFrame(
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
index=index,
columns=["C1", "C2", "C3"],
)
result = (
df.style.hide(axis="index", level=[0, 1, 2])
Expand All @@ -1484,6 +1488,5 @@ def test_to_latex_multiindex_format_triple_index_all_hidden(self):
0 & 0 & 0 \\
0 & 0 & 0 \\
\end{tabular}
"""
)
""")
assert result == expected

0 comments on commit eb03762

Please sign in to comment.