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: add NotImplementedError error for index changing methods Dask #744

Merged
merged 6 commits into from
Aug 8, 2024

Conversation

anopsy
Copy link
Member

@anopsy anopsy commented Aug 8, 2024

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below.

If this looks good I'll also add NotImplementedError to the following methods and this PR
Expr.sort
Expr.head
Expr.tail

@github-actions github-actions bot added the enhancement New feature or request label Aug 8, 2024
@@ -445,6 +450,16 @@ def clip(
returns_scalar=False,
)

def head(self) -> NoReturn:
# We can't (yet?) allow methods which modify the index
msg = "`Expr.head` is not supported for the Dask backend. Please use `LazyFrame.head` instead."
Copy link
Member

@FBruzzesi FBruzzesi Aug 8, 2024

Choose a reason for hiding this comment

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

Quick heads up: sadly DaskLazyframe also doesn't implement head (nor tail) πŸ₯²

Copy link
Member Author

Choose a reason for hiding this comment

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

🫠 Where can I check that? I only found Dask API reference for Arrays and DataFrames

Copy link
Member

@FBruzzesi FBruzzesi Aug 8, 2024

Choose a reason for hiding this comment

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

LazyFrame will point to DaskLazyFrame for the dask backend, and the message is suggesting to use such method, so I guess you can check if present in narwhals/_dask/dataframe.py?

Copy link
Member Author

@anopsy anopsy Aug 8, 2024

Choose a reason for hiding this comment

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

Thank you!
image

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @anopsy ! nice use of noreturn

@MarcoGorelli MarcoGorelli merged commit 3c6fa8c into narwhals-dev:main Aug 8, 2024
20 checks passed
mistShard pushed a commit to mistShard/narwhals that referenced this pull request Aug 8, 2024
…arwhals-dev#744)

* add notImplemented error for index changing methods Dask

* add NotImplementedError to index changing methods Dask

* add NotImplementedError in Dask drop_null/count

* Update expr.py

---------

Co-authored-by: Marco Edward Gorelli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants