-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: unstack #33474
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
REF: unstack #33474
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7c33dc2
REF: move shared calls up the stack
jbrockmendel bc19cad
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel 45c7a8f
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel b2feffe
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel 80e0204
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
jbrockmendel 8f0e5d4
Comments
jbrockmendel 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ def sorted_labels(self): | |
indexer, to_sort = self._indexer_and_to_sort | ||
return [l.take(indexer) for l in to_sort] | ||
|
||
def _make_sorted_values(self, values): | ||
def _make_sorted_values(self, values: np.ndarray) -> np.ndarray: | ||
indexer, _ = self._indexer_and_to_sort | ||
|
||
sorted_values = algos.take_nd(values, indexer, axis=0) | ||
|
@@ -205,6 +205,9 @@ def get_new_values(self, values, fill_value=None): | |
|
||
# we can simply reshape if we don't have a mask | ||
if mask_all and len(values): | ||
# TODO: Under what circumstances can we rely on sorted_values | ||
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. I think if the we are sorted already then you can simplify, but I am not sure we can make that guarantee. |
||
# matching values? When that holds, we can slice instead | ||
# of take (in particular for EAs) | ||
new_values = ( | ||
sorted_values.reshape(length, width, stride) | ||
.swapaxes(1, 2) | ||
|
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.
@jbrockmendel I think it's just this line that caused the regression in #37115 and that we don't need to revert the complete PR.
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.
what kind of block(s) do you end up with instead?
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.
corrupted? an IntBlock with dtype float64
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.
run the test suite with just this change reverted and all tests pass. will put up a PR shortly.