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

FIX-#7157: Make sure quantile function works with numeric_only=True #7160

Merged
merged 4 commits into from
Apr 11, 2024

Conversation

anmyachev
Copy link
Collaborator

@anmyachev anmyachev commented Apr 9, 2024

What do these changes do?

  • 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 BUG: The quantile method throws exceptions in some scenarios #7157
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

return self.__constructor__(
query_compiler=self._query_compiler.quantile_for_list_of_values(
axis = numeric_only_df._get_axis_number(axis)
if isinstance(q, (pandas.Series, np.ndarray, pandas.Index, list, tuple)):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One of the problems was that in the case of a tuple, the quantile_for_list_of_values implementation must be used (instead of quantile_for_single_value).

Comment on lines +2326 to +2330
numeric_only_df = self.drop(
columns=[
i for i in self.dtypes.index if not is_numeric_dtype(self.dtypes[i])
]
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the second problem, due to the fact that we did not drop non numeric columns, internal and external index did not match.

numeric_only=True case has not been tested before.

@anmyachev anmyachev marked this pull request as ready for review April 9, 2024 16:46
modin/tests/pandas/dataframe/test_window.py Outdated Show resolved Hide resolved
modin/pandas/base.py Show resolved Hide resolved
modin/pandas/base.py Show resolved Hide resolved
anmyachev and others added 4 commits April 11, 2024 14:10
Signed-off-by: Anatoly Myachev <[email protected]>
Signed-off-by: Anatoly Myachev <[email protected]>
@YarShev YarShev merged commit 0755a61 into modin-project:master Apr 11, 2024
38 checks passed
@anmyachev anmyachev deleted the issue7157 branch April 11, 2024 13:25
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.

BUG: The quantile method throws exceptions in some scenarios
2 participants