-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Deprecate convert_float #41176
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 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
53505d2
CLN: Deprecate convert_float, GH#41127
ahawryluk 9dbe791
Linting
ahawryluk a0d9800
Linting 2
ahawryluk 08dcec2
Warning stacklevel
ahawryluk 8fdb626
Warning stacklevel=5
ahawryluk 86fadd0
TST Don't raise_on_extra_warnings
ahawryluk 42d25af
Inspect stacklevel
ahawryluk 5987202
Add comment about raise_on_extra_warnings
ahawryluk 791ec0b
2nd comment for raise_on_extra_warnings
ahawryluk f8ef797
CLN: consolidate stack inpection into a function
ahawryluk bccf4aa
Merge branch 'master' into depr_convert_floats
ahawryluk 196a899
Merge branch 'master' into depr_convert_floats
ahawryluk a0f2677
Use find_stack_trace from pandas.util._exceptions
ahawryluk 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
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.
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.
this is slightly magical. can we instead have a function that shows the deprecation and just call it where appropriate so can set the stacklevel w/o this?
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.
I don't see how this would get around needing logic to set the stacklevel. Maybe you're asking to move the logic to the new function?
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.
@jreback @rhshadrach I've consolidated both stack inspections from _base.py into a single function. It seems like an improvement to me, but let me know if you see other adjustments I should make.
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.
After rereading @jreback's comment, it now makes sense to me. The request is to move the deprecation itself to a function (not the determination of stacklevel), and call this further up in the call stack where we don't need to have any logic to determine the stacklevel. If this is doable, I agree it's a better approach.
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.
I think this would work: move the
warnings.warn
to a function, call in both read_excel and ExcelFile.parse when appropriate, but in read_excel after emitting the warning change the value of convert_float. Does that make sense?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.
you might be able to use this:
from pandas.util._exceptions import find_stack_level
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.
Oh nice. I looked at
pandas.util._exceptions.find_stack_level
when I made my last edit, but at the time it seemed specific to "astype" et al. so I tried making something similar. The edits from #41560 two days ago look great. I'll give it a try right away. (I couldn't see a clean way without stack inspection to raise a single warning from both read_excel and ExcelFile.parse. The latter isn't really advertised in the documentation, but it should still raise the correct warnings.)