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

change sample method to work for pandas #23

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

raisadz
Copy link
Contributor

@raisadz raisadz commented Mar 19, 2024

No description provided.

@MarcoGorelli
Copy link
Member

wonderful, thanks! fancy adding a little test which just makes an assertion on the length of the output if we use this?

@raisadz
Copy link
Contributor Author

raisadz commented Mar 20, 2024

I added __invert__() method in narwhals/expression.py and tests for .is_null() and .sample() functions. It looks like there are some issues with pandas indexing for .sample() and .drop_nulls() methods. Also, .sample() returns an eager dataframe when the native dataframe is pandas and a lazy dataframe when the native is Polars and this results in the error AttributeError: 'DataFrame' object has no attribute 'collect' for pandas and modin inputs in test test_expr_sample.

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.

@MarcoGorelli MarcoGorelli merged commit 47eea5a into narwhals-dev:main Mar 20, 2024
11 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.

2 participants