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

REFACTOR-#5310: Remove some hasattr('columns') checks. #5311

Merged

Conversation

mvashishtha
Copy link
Collaborator

Signed-off-by: mvashishtha [email protected]

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 REFACTOR: Get rid of some hasattr(obj, "columns") checks #5310
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

@mvashishtha mvashishtha requested a review from a team as a code owner December 2, 2022 09:41
modin/pandas/base.py Fixed Show fixed Hide fixed
modin/pandas/base.py Outdated Show resolved Hide resolved
modin/pandas/base.py Show resolved Hide resolved
@mvashishtha mvashishtha force-pushed the 5310-remove-hasattr-columns-checks branch from acd516a to 1c3be74 Compare December 6, 2022 01:47
modin/pandas/base.py Outdated Show resolved Hide resolved
@@ -315,7 +315,7 @@ def broadcast_item(
index_values = obj.index[row_lookup]
if not index_values.equals(item.index):
axes_to_reindex["index"] = index_values
if need_columns_reindex and hasattr(item, "columns"):
if need_columns_reindex and isinstance(item, (pandas.DataFrame, DataFrame)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

this looks super-weird, should we really support both pandas and Modin versions of DataFrame here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We just need DataFrame. Done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It turns out we need both. Tests fail if we don't include both.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this should be a bug that we need both... cc @devin-petersohn

mvashishtha added 7 commits December 6, 2022 12:33
@mvashishtha mvashishtha force-pushed the 5310-remove-hasattr-columns-checks branch from b73dc9b to b9eae58 Compare December 6, 2022 18:38
Copy link
Collaborator

@vnlitvinov vnlitvinov left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

REFACTOR: Get rid of some hasattr(obj, "columns") checks
4 participants