| th_empty_trailing_rows(datapath, ext, read_only): | |
| # GH 39181 | |
| path = datapath("io", "data", "excel", f"empty_trailing_rows{ext}") | |
| if read_only is None: | |
| result = pd.read_excel(path) | |
| else: | |
| with contextlib.closing( | |
| openpyxl.load_workbook(path, read_only=read_only) | |
| ) as wb: | |
| result = pd.read_excel(wb, engine="openpyxl") | |
| expected = DataFrame( | |
| { | |
| "Title": [np.nan, "A", 1, 2, 3], | |
| "Unnamed: 1": [np.nan, "B", 4, 5, 6], | |
| "Unnamed: 2": [np.nan, "C", 7, 8, 9], | |
| } | |
| ) | |
| tm.assert_frame_equal(result, expected) |