-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: inconsistency in dtype of replace() #44897
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 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d0565b1
Dtype is same
shubham11941140 2fc7c96
pre-commit hook solved
shubham11941140 cb4dd4f
Update blocks.py
shubham11941140 1129c9a
changed replace regex
shubham11941140 1a1c378
precommit solved
shubham11941140 eb06d43
Changed test to assert series equal
shubham11941140 fdbd5f5
Changes test
shubham11941140 087aad2
Added parameterise
shubham11941140 d0f3c7f
Merge branch 'master' into b6
shubham11941140 54f5676
changed
shubham11941140 c83c2b6
Update blocks.py
shubham11941140 a438762
Added test
shubham11941140 9617165
precommit
shubham11941140 36e9a5d
Added extra testcase
shubham11941140 f04d05d
Changed to string
shubham11941140 ddbb113
whatsnew note added - 1.4
shubham11941140 75e3bd8
whatsnew fixed
shubham11941140 af0585c
whatsnew-fix
shubham11941140 2a80b69
fix1
shubham11941140 e281264
fix2
shubham11941140 d00915b
Moved testcase below
shubham11941140 2fd474c
Merge branch 'master' of https://github.com/pandas-dev/pandas into b6
shubham11941140 0d93bdd
Changed Whatsnew note
shubham11941140 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
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.
when we use this pattern the 'else' path usually involves split_and_operate
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.
In the previous case where the dimensions are as follows split and operate don't operate on these dimensions, for split and operate you need
assert self.ndim == 2 and self.shape[0] != 1
, which we do not use here.Since we have a single element here, we should not split and upcast, right?
Uh oh!
There was an error while loading. Please reload this page.
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.
not sure i understand. im saying its weird to see this check on L734 and not see a split_and_operate on L737.
e.g. in the test you implemented, what happens if you use
pd.DataFrame({"A": ["0"], "B": ["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.
In
replace_regex
, we have aldready applied the replacement with the only issue of the type cast. So, if I apply split_and_operate again, it won't give any specific result except for converting dtype before breaking a lot of tests. The solution is correct with the dtype being wrong.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.
pd.DataFrame({"A": ["0"], "B: ["0"]})
is giving a dtype assertion errorThere 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.
can you paste it?
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 rectified it, the testcase has been added.