Skip to content

Commit 385f5f0

Browse files
committed
Fixing my code
1 parent aa8101d commit 385f5f0

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

pandas/io/formats/excel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def __init__(
566566
if cols is not None:
567567
# all missing, raise
568568
if not len(Index(cols).intersection(df.columns)):
569-
raise KeyError("Passed columns are not ALL present dataframe")
569+
raise KeyError("passes columns are not ALL present dataframe")
570570

571571
if len(Index(cols).intersection(df.columns)) != len(set(cols)):
572572
# Deprecated in GH#17295, enforced in 1.0.0

pandas/tests/io/formats/test_to_excel.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,24 +625,21 @@ def test_formated_header_mi_multi_index_throws(self):
625625
("Amazing", "C"), ("Amazing", "D")
626626
]
627627
columns = MultiIndex.from_tuples(header)
628+
rng = np.random.default_rng()
628629
df = DataFrame(
629-
np.random.randn(4, 4),
630+
rng.standard_normal((4, 4)),
630631
columns=columns
631632
)
632633
formatter = ExcelFormatter(df, index=False)
633634
assert(formatter.columns.nlevels > 1 and not formatter.index)
634-
msg = (
635-
"Writing to Excel with MultiIndex columns and no "
636-
"index ('index'=False) is not yet implemented."
637-
)
638635
with pytest.raises(NotImplementedError):
639636
list(formatter._format_header_mi())
640637

641638
def test_returns_none_no_header(self):
642639
df = DataFrame({"A": [1,2], "B": [3,4]})
643640
formatter = ExcelFormatter(df,header=False)
644-
assert(formatter._has_aliases == False)
645-
assert(list(formatter._format_header_mi()) == list())
641+
assert(not formatter._has_aliases)
642+
assert(list(formatter._format_header_mi()) == [])
646643

647644
@pytest.mark.parametrize(
648645
"df, merge_cells, expected_cells",
@@ -1014,7 +1011,8 @@ def test_generate_body_general(self, df, coloffset, rowcounter, expected_cells):
10141011
),
10151012
],
10161013
)
1017-
def test_get_formatted_cells_integration(self, df, formatter_options, expected_values):
1014+
def test_get_formatted_cells_integration(self, df, formatter_options,
1015+
expected_values):
10181016
"""
10191017
Integration test for get_formatted_cells to ensure it chains all
10201018
formatting methods and applies final value formatting correctly.

0 commit comments

Comments
 (0)