Skip to content

BUG: fixes formatted value error for missing sheet (#27676) #27677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c25f93b
BUG: fixes formatted value error for missing sheet
JasperVanDenBosch Jul 31, 2019
6665fdb
added reference to bug fix for #27676 in whats new
JasperVanDenBosch Aug 1, 2019
c83c7c9
TST: Add test for read_excel with odf engine and nonexistent sheetname
JasperVanDenBosch Aug 1, 2019
406f1a0
CLN: black fix in test_odf
JasperVanDenBosch Aug 1, 2019
90897c5
TST: sheet_name test now in test_readers
JasperVanDenBosch Aug 1, 2019
a4efca0
TST: test_nonexistent_sheetname_raises required read_ext param
JasperVanDenBosch Aug 1, 2019
4d54e3a
Merge remote-tracking branch 'upstream/master' into ilogue-fix-odfrea…
TomAugspurger Aug 20, 2019
e93b25a
review comments
TomAugspurger Aug 20, 2019
1c2fc81
moved odf reader error message test back to odf tests
JasperVanDenBosch Aug 23, 2019
2bfb709
CLN: missing blank line
JasperVanDenBosch Aug 23, 2019
af96eef
Merge branch 'master' into fix-odfreader-sheetname-missing
JasperVanDenBosch Aug 23, 2019
c149675
Merge branch 'master' into fix-odfreader-sheetname-missing
JasperVanDenBosch Sep 10, 2019
bec56d9
reverted changes to v0.25.1 whatsnew
JasperVanDenBosch Sep 10, 2019
a93b355
added line for #27676 in whatsnew 0.25.2
JasperVanDenBosch Sep 10, 2019
c45ffb3
[TST] fixed odf unittest
JasperVanDenBosch Sep 24, 2019
589cbb1
[TST]: odf tests: hardcoded blank workbook extension as .ods
JasperVanDenBosch Sep 25, 2019
56cc92d
moved whatsnew entry to 1.0
JasperVanDenBosch Oct 9, 2019
669221d
Merge branch 'master' into fix-odfreader-sheetname-missing
JasperVanDenBosch Oct 9, 2019
5e92329
Merge branch 'master' into fix-odfreader-sheetname-missing
JasperVanDenBosch Oct 24, 2019
04fb46b
Removed whatsnew 1.0 entry for #26838 from merged master
JasperVanDenBosch Oct 25, 2019
3d135fb
Update v0.25.2.rst
WillAyd Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ I/O
- Bug in :func:`read_hdf` closing stores that it didn't open when Exceptions are raised (:issue:`28699`)
- Bug in :meth:`DataFrame.read_json` where using ``orient="index"`` would not maintain the order (:issue:`28557`)
- Bug in :meth:`DataFrame.to_html` where the length of the ``formatters`` argument was not verified (:issue:`28469`)
- Bug in :meth:`DataFrame.read_excel` with ``engine='ods'`` when ``sheet_name`` argument references a non-existent sheet (:issue:`27676`)
- Bug in :meth:`pandas.io.formats.style.Styler` formatting for floating values not displaying decimals correctly (:issue:`13257`)

Plotting
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/excel/_odfreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_sheet_by_name(self, name: str):
if table.getAttribute("name") == name:
return table

raise ValueError("sheet {name} not found".format(name))
raise ValueError("sheet {} not found".format(name))

def get_sheet_data(self, sheet, convert_float: bool) -> List[List[Scalar]]:
"""Parse an ODF Table into a list of lists
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/io/excel/test_odf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ def test_read_writer_table():
result = pd.read_excel("writertable.odt", "Table1", index_col=0)

tm.assert_frame_equal(result, expected)


def test_nonexistent_sheetname_raises(read_ext):
# GH-27676
# Specifying a non-existent sheet_name parameter should throw an error
# with the sheet name.
with pytest.raises(ValueError, match="sheet xyz not found"):
pd.read_excel("blank.ods", sheet_name="xyz")