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

Conversation

JasperVanDenBosch
Copy link
Contributor

@JasperVanDenBosch JasperVanDenBosch commented Jul 31, 2019

Fixes a formatted message at io.excel._odfreader line 62

@TomAugspurger
Copy link
Contributor

Thanks. Could you release note under "Bug fixes" in doc/source/v0.25.1.rst and a test ensuring that the sheet name is including the the error message?

@TomAugspurger
Copy link
Contributor

You can ignore the codecov failure.

@TomAugspurger TomAugspurger added this to the 0.25.1 milestone Jul 31, 2019
@TomAugspurger TomAugspurger added Error Reporting Incorrect or improved errors from pandas IO Excel read_excel, to_excel labels Jul 31, 2019
@WillAyd
Copy link
Member

WillAyd commented Aug 1, 2019

Looks good. Can you check test coverage for this though? Should have one for all excel / odf engines

@WillAyd
Copy link
Member

WillAyd commented Aug 1, 2019

Interesting that all of the engines raise differently... @ilogue do you have an idea of effort to align all of these messages? Would ideally like to do here if not too much effort but could also leave to a follow up if non-trivial

@JasperVanDenBosch
Copy link
Contributor Author

@WillAyd by align do you mean catch the exceptions thrown by the other packages and rethrow a common pandas exception? Or ask the maintainers of those packages to change their error message?

@WillAyd
Copy link
Member

WillAyd commented Aug 1, 2019

Yea I mean raise one common error message from get_sheet_by_name in the various excel readers. So for example since xlrd raises an XLRDError would catch and re-raise a ValueError that matches what would happen with openpyxl and odfpy

@@ -25,6 +25,7 @@ Other enhancements
Bug fixes
~~~~~~~~~

- Bug in :meth:`DataFrame.read_excel` with `engine='ods'` when `sheet_name` argument references a non-existent sheet (:issue:`27676`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this to the IO section, double backticks rather than single around engine='ods' and sheet_name

@TomAugspurger
Copy link
Contributor

@ilogue looks like the CI is failing. Do these tests pass for you locally?

@JasperVanDenBosch
Copy link
Contributor Author

JasperVanDenBosch commented Aug 21, 2019

No they don't work, because they currently target all engines. So we could

  1. Moved the test back to the engine specific module
  2. Implement BUG: fixes formatted value error for missing sheet (#27676) #27677 (comment)

@JasperVanDenBosch
Copy link
Contributor Author

Sorry didn't mean to close, on my phone

@TomAugspurger
Copy link
Contributor

Do you have an opinion on which option is better?

@TomAugspurger TomAugspurger modified the milestones: 0.25.1, 1.0 Aug 21, 2019
@pep8speaks
Copy link

pep8speaks commented Aug 23, 2019

Hello @ilogue! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-10-25 16:02:56 UTC

@@ -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(self, read_ext):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of self here is causing the error. This isn't a class method so that's what is failing CI.

If you remove I think should turn green

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be done in c45ffb3

@jreback jreback modified the milestones: 0.25.2, 1.0 Sep 20, 2019
zero323 added a commit to zero323/pandas that referenced this pull request Oct 8, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On phone so can’t check but looks like there is an outstanding CI failure that needs to be addressed. Otherwise lgtm

@@ -64,7 +64,7 @@ I/O

- Fix regression in notebook display where <th> tags not used for :attr:`DataFrame.index` (:issue:`28204`).
- Regression in :meth:`~DataFrame.to_csv` where writing a :class:`Series` or :class:`DataFrame` indexed by an :class:`IntervalIndex` would incorrectly raise a ``TypeError`` (:issue:`28210`)
-
- Bug in :meth:`DataFrame.read_excel` with ``engine='ods'`` when ``sheet_name`` argument references a non-existent sheet (:issue:`27676`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to 1.0.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@WillAyd
Copy link
Member

WillAyd commented Oct 24, 2019

@ilogue can you fix up merge conflicts and revert any changes to 0.25.2 whatsnew?

@JasperVanDenBosch
Copy link
Contributor Author

@ilogue can you fix up merge conflicts and revert any changes to 0.25.2 whatsnew?

@WillAyd done

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc comment, ping on green.

@@ -398,6 +399,12 @@ Sparse
-
-


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this is, pls remove

@WillAyd WillAyd merged commit d7de334 into pandas-dev:master Oct 25, 2019
@WillAyd
Copy link
Member

WillAyd commented Oct 25, 2019

Great thanks @ilogue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_excel: sheet_name of non-existent sheet does not raise appropriate error for engine='odf'
5 participants