-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/df.agg-with-df-with-missing-values-results-in-IndexError #58864
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1824,12 +1824,15 @@ def relabel_result( | |||||
fun = [ | ||||||
com.get_callable_name(f) if not isinstance(f, str) else f for f in fun | ||||||
] | ||||||
col_idx_order = Index(s.index).get_indexer(fun) | ||||||
s = s.iloc[col_idx_order] | ||||||
col_idx_order = list(Index(s.index).get_indexer(fun)) | ||||||
col_idx_order = [i for i in col_idx_order if 0 <= i < len(s)] | ||||||
if col_idx_order: | ||||||
s = s.iloc[col_idx_order] | ||||||
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. Instead I think you can filter 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. Yeah, makes sense. |
||||||
|
||||||
# assign the new user-provided "named aggregation" as index names, and reindex | ||||||
# it based on the whole user-provided names. | ||||||
s.index = reordered_indexes[idx : idx + len(fun)] | ||||||
if len(s) > 0: | ||||||
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.
Suggested change
|
||||||
s.index = reordered_indexes[idx : idx + len(fun)] | ||||||
reordered_result_in_dict[col] = s.reindex(columns) | ||||||
idx = idx + len(fun) | ||||||
return reordered_result_in_dict | ||||||
|
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 should be in the bug fix section
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.
Moved.