-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: upcasting on reshaping ops #13247 #15594
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
468baee
BUG: upcasting on reshaping ops #13247
jaehoonhwang 45f7ae9
Added pytest function
jaehoonhwang 4b1e5c6
Merge remote-tracking branch 'pandas-dev/master' into Bug13247
jaehoonhwang b977615
Merge remote-tracking branch 'pandas-dev/master'
jaehoonhwang d3476c0
Merge branch 'master' into Bug13247
jaehoonhwang 4f6c03e
Fix: is_float_dtypes and is_numeric_dtype wrong place
jaehoonhwang 8fec07c
Fix: test_concat.py and internals.py
jaehoonhwang 0e52b74
Working: Except for pytest
jaehoonhwang 8122359
Merge remote-tracking branch 'pandas-dev/master' into Bug13247
jaehoonhwang a1d5d40
Completed pytest
jaehoonhwang 5bb72c7
Merge remote-tracking branch 'pandas-dev/master' into Bug13247
jaehoonhwang 6744636
Merge remote-tracking branch 'pandas-dev/master' into Bug13247
jaehoonhwang 1fa578b
Applying request changes removing unnecessary test and renameing
jaehoonhwang 3cd1734
Pass the non-related tests in test_partial and test_reshape
jaehoonhwang 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1899,3 +1899,38 @@ def test_concat_multiindex_dfs_with_deepcopy(self): | |
tm.assert_frame_equal(result_copy, expected) | ||
result_no_copy = pd.concat(example_dict, names=['testname']) | ||
tm.assert_frame_equal(result_no_copy, expected) | ||
|
||
|
||
def test_concat_no_unnecessary_upcats(self): | ||
# GH 13247 | ||
|
||
for pdt in [pd.Series, pd.DataFrame, pd.Panel, pd.Panel4D]: | ||
dims = pdt().ndim | ||
for dt in np.sctypes['float']: | ||
dfs = [pdt(np.array([1], dtype=dt, ndmin=dims)), | ||
pdt(np.array([np.nan], dtype=dt, ndmin=dims)), | ||
pdt(np.array([5], dtype=dt, ndmin=dims))] | ||
x = pd.concat(dfs) | ||
self.assertTrue(x.values.dtype == dt) | ||
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. just do |
||
|
||
for dt in(np.sctypes['int'] + np.sctypes['uint']): | ||
dfs = [pdt(np.array([1], dtype=dt, ndmin=dims)), | ||
pdt(np.array([5], dtype=dt ,ndmin=dims))] | ||
x = pd.concat(dfs) | ||
self.assertTrue(x.values.dtype == dt) | ||
|
||
objs = [] | ||
objs.append(pdt(np.array([1], dtype=np.float32, ndmin=dims))) | ||
objs.append(pdt(np.array([1], dtype=np.float16, ndmin=dims))) | ||
self.assertTrue(pd.concat(objs).values.dtype == np.float32) | ||
|
||
objs = [] | ||
objs.append(pdt(np.array([1], dtype=np.int32, ndmin=dims))) | ||
objs.append(pdt(np.array([1], dtype=np.int64, ndmin=dims))) | ||
self.assertTrue(pd.concat(objs).values.dtype == np.int64) | ||
|
||
# not sure what is the best answer here | ||
objs = [] | ||
objs.append(pdt(np.array([1], dtype=np.int32, ndmin=dims))) | ||
objs.append(pdt(np.array([1], dtype=np.float16, ndmin=dims))) | ||
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. you don't need these tests as you have the ones below |
||
self.assertTrue(pd.concat(objs).values.dtype == np.float64) |
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.
can u write this in pytest form using parametrize (needs to be a separate 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.
Okay, but I need to read up on documentation and it might take some time.
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.
sure will be something like
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.
FYI only need to do Series/DataFrame/Panel
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 need
pytest
module for using@parametrize
.Should I create another class for pytest?