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.
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
Fixed Inconsistent GroupBy Output Shape with Duplicate Column Labels #29124
Fixed Inconsistent GroupBy Output Shape with Duplicate Column Labels #29124
Changes from 50 commits
fd53827
6f60cd0
0aa1813
4af22f6
9756e74
b675963
444d542
98a9901
c8648b1
1626de1
2a6b8d7
12d1ca0
5a3fcd7
dee597a
a2f1b64
fdb36f6
8975009
9adde1b
63b35f9
9eb7c73
0e49bdb
2ad7632
11fda39
caf8f11
7c4bad9
b9dca96
a878e67
037f9af
dd3b1dc
a66d37f
6d50448
4dd8f5b
9d39862
d6b197b
3cfd1a2
16e9512
d297684
a234bed
e3959b0
391d106
c30ca82
3a78051
f4f9e61
936591e
5dd131e
6cc1607
d5ce753
ce97eff
d1a92b4
23eb803
4aa9f4c
faa08c9
b07335b
fb71185
d7b84a2
7934422
c8f0b19
acf22d3
a0aae64
a9b411a
51b8050
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 by definition always true right as this is a property of a mapping? an assertion here is confusing
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.
Isn’t this what you had asked me to add asserts for previously? If not then I am confused as to what asserts you wanted
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.
FWIW I don't consider this to be a long term approach anyway. Probably easier to make a named tuple that holds the position and label of each item in the result and construct from there; happy to do as a follow up
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 at all. an assert about a property of a dict is not very useful.
I asked about an assert about the sortness of output. you are assigning .columns = columns. The keys must be in the same order. There is no guarantee on this at all (except that dicts are sorted in > 3.6 and I think you must be adding them in the same order). but this is non-obvious, and non-trivial.
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 isn't a dict property though - any chance you are mixing up a dict maintaining insertion order versus being sorted?
Sorting the output would add a behavior change that I don't think is desirable either. I do agree this isn't the clearest way of managing in the long run but I'm trying to limit the scope of the PR.
Any chance we can move forward as is and I can redo the dict insertion in a follow up? I think should just use a namedtuple or something similar as the dict key that holds the position and label together
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 are still missing my point.
you are assigning
.columns = columns
. prove that this is the same order as the dict keys.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.
Right there is no easy way to do this in the current iteration. I was planning to do as a follow up - is that a requirement to do here?
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 there is, you are creating an enumeration of lables (0, 1....etc), you just need to assert that the columns are in the same order here.
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.
why is this not always true?
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.
here and elsewhere the
Union[Series, np.ndarray]
never gets EA?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 it does.
I had a go at trying to avoid the cast, and needed an instance EA in _wrap_series_output to get the tests to pass.
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.
p.s. I don't recommend the above since still needed
len(output) > 1
in the condition so the return type could not be established with the argument type alone and therefore overloading is not the answer here.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.
same comment as above, I think you need to sort the columns (index is ok )