Skip to content
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

FEAT-#7117: Support building range-partitioning from an index level #7120

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

dchigarev
Copy link
Collaborator

@dchigarev dchigarev commented Mar 25, 2024

What do these changes do?

Adds support for building range-partitioning based on an index level(s) and enables range-partitioning support for df.groupby(level=...) cases.

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves Support building range-partitioning from an index level #7117
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

…index level

Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
if RangePartitioningGroupby.get():
return tuple(df.sort_index() for df in dfs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously, the function was only sorting by index, however in case of the low amount of unique values in the index this approach may not work well, so sorting on column values as it appears to be more stable for dataframes

@@ -2453,7 +2454,7 @@ def _apply_func_to_range_partitioning(
Parameters
----------
key_columns : list of hashables
Columns to build the range partitioning for.
Columns to build the range partitioning for. Can't be specified along with `level`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandas.groupby.level doc says: "Do not specify both by and level.", so we're putting the same restriction

@@ -1726,7 +1746,7 @@ def test_groupby_getitem_preserves_key_order_issue_6154():
],
)
def test_groupby_multiindex(groupby_kwargs):
frame_data = np.random.randint(0, 100, size=(2**6, 2**4))
frame_data = np.random.randint(0, 100, size=(2**6, 2**6))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

increased the number from 16 to 64 to use multiple partitions

@YarShev YarShev merged commit 9afc049 into modin-project:master Apr 2, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support building range-partitioning from an index level
2 participants