-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DEPR: deprecate non keyword arguments in read_excel #34418
DEPR: deprecate non keyword arguments in read_excel #34418
Conversation
@@ -33,7 +33,7 @@ def test_read_writer_table(): | |||
columns=["Column 1", "Unnamed: 2", "Column 3"], | |||
) | |||
|
|||
result = pd.read_excel("writertable.odt", "Table1", index_col=0) | |||
result = pd.read_excel("writertable.odt", sheet_name="Table1", index_col=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is sheet_name
required to be passed like this or still OK positionally? I assume the latter from allowed_args
being 2 but maybe am misreading
+/- 0 on making this required as a keyword argument. It would seem a rather natural positional argument so maybe not worth the churn, but not a strong opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is sheet_name required to be passed like this or still OK positionally?
This is just a cleanup, I think it's more readable with keyword arguments.
I think exel files are very well known, so people will easily infer that the second parameter is the sheet name, and making positional argument for sheet_name fail, e.g. in jupyter notebook could maybe be seen as too restrictive. This is not a strong opinion, so if making it a required kwarg is seen as better, I can do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. can you add this issue to the deprecation removal 2.0 issue; @WillAyd over to you.
Great PR @topper-123 |
Follow-up to #27573.
Allows two non-keyword arguments,
io
andsheet_name
. I thinksheet_name
is quite often (e.g. Interactively) supplied without being a keyword argument and requiring it will just be needlessly annoying.Also some clean-up in pandas/tests/io/excel.