-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: **kwargs in ExcelWriter #40430
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2c2f863
DEPR: **kwargs in ExcelWriter
rhshadrach a95c31f
GH # in test
rhshadrach e961452
fixup
rhshadrach 21f8168
Fix type-hint
rhshadrach 3dfea8f
Added test and versionadded
rhshadrach 1b75a4e
Merge branch 'master' of https://github.com/pandas-dev/pandas into ex…
rhshadrach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -667,6 +667,16 @@ class ExcelWriter(metaclass=abc.ABCMeta): | |
be parsed by ``fsspec``, e.g., starting "s3://", "gcs://". | ||
|
||
.. versionadded:: 1.2.0 | ||
engine_kwargs : dict, optional | ||
Keyword arguments to be passed into the engine. | ||
|
||
.. versionadded:: 1.3.0 | ||
**kwargs : dict, optional | ||
Keyword arguments to be passed into the engine. | ||
|
||
.. deprecated:: 1.3.0 | ||
|
||
Use engine_kwargs instead. | ||
|
||
Attributes | ||
---------- | ||
|
@@ -745,7 +755,26 @@ class ExcelWriter(metaclass=abc.ABCMeta): | |
# You also need to register the class with ``register_writer()``. | ||
# Technically, ExcelWriter implementations don't need to subclass | ||
# ExcelWriter. | ||
def __new__(cls, path, engine=None, **kwargs): | ||
def __new__( | ||
cls, | ||
path: Union[FilePathOrBuffer, ExcelWriter], | ||
engine=None, | ||
date_format=None, | ||
datetime_format=None, | ||
mode: str = "w", | ||
storage_options: StorageOptions = None, | ||
engine_kwargs: Optional[Dict] = None, | ||
**kwargs, | ||
): | ||
if kwargs: | ||
if engine_kwargs is not None: | ||
raise ValueError("Cannot use both engine_kwargs and **kwargs") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a test for this |
||
warnings.warn( | ||
"Use of **kwargs is deprecated, use engine_kwargs instead.", | ||
FutureWarning, | ||
stacklevel=2, | ||
) | ||
jreback marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# only switch class if generic(ExcelWriter) | ||
|
||
if cls is ExcelWriter: | ||
|
@@ -835,7 +864,8 @@ def __init__( | |
datetime_format=None, | ||
mode: str = "w", | ||
storage_options: StorageOptions = None, | ||
**engine_kwargs, | ||
engine_kwargs: Optional[Dict] = None, | ||
**kwargs, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and not do this |
||
): | ||
# validate that this engine can handle the extension | ||
if isinstance(path, str): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.