question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

read_excel does not raise error with wrong keyword arg

See original GitHub issue

For example:

pd.read_excel('file_name.xlsx',sheet='mysheet')

does not raise any error. The right parameter name is “sheetname” . If “sheet” is passed it defaults to the first sheet and no error is raised.

sheetname and sheet are very similar and easy to confuse.

One might think that it is reading the sheet passed as argument when in fact it is another one.

I would like to suggest for errors to be raised if unexpected args are passed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
joonrocommented, Dec 5, 2017

+1. I just got bitten by sheet_name.

0reactions
TomAugspurgercommented, May 26, 2018

I think the goal is to remove the **kwargs from the signature. Then we don’t have to worry about validating unknown parameters.

On Fri, May 25, 2018 at 8:50 AM, Luciano Viola notifications@github.com wrote:

Hey guys, I’m having a bit of difficulty figuring out how to solve this one. I’m new to open source contributing, but I’m really excited about it.

My initial solution was to raise a warning if “sheet” was in kwargs, it does not generalize to things like “Sheet”.

So, in my view, we either list all possible misspellings and and confusion possibilities of sheetname and check directly check it they where passed, or we review the need to have kwargs.

I don’t think that words like "Sheet’ are such a problem, I don’t think its a very common mistake. The one I’m concerned about is “sheet”.

What do you guys think? =)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pandas-dev/pandas/issues/17994#issuecomment-392064067, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQHInNXhjgshmcamekAWgLFLrFX_H0bks5t2Aw8gaJpZM4QH-GS .

Read more comments on GitHub >

github_iconTop Results From Across the Web

valid parameters to pandas method - python - Stack Overflow
Pandas take keyword arguments **kwds as an argument in read_excel function, that's why it is not throwing error. pandas.pydata.org/pandas-docs/ ...
Read more >
What's new in 1.3.0 (July 2, 2021) - Pandas
When incorrectly formatted CSS is given via Styler.apply() or Styler.applymap() , an error is now raised upon rendering (GH39660).
Read more >
Reading Poorly Structured Excel Files with Pandas
The simplest solution for this data set is to use the header and usecols arguments to read_excel() . The usecols parameter, in particular,...
Read more >
How IOError work in Python with Programming Examples
The primary use of finally here will be to execute the code no matter what error is caught or handled. Conclusion. IOError in...
Read more >
Read Messy Excel Files Like a Pro | by Tim Meehan
One thing to note is the pd.read_excel() file will usually return ... You've most likely used it before, but it has a handy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found