-
Notifications
You must be signed in to change notification settings - Fork 119
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
test: Add cudf_constructor
to conftest
#797
Conversation
cudf_constructor
to conftestcudf_constructor
to conftest
import numpy as np # ignore-banned-import | ||
|
||
ser = self._native_series | ||
res = np.flatnonzero(ser) | ||
return self._from_native_series( | ||
native_series_from_iterable( | ||
res, | ||
name=self.name, | ||
index=range(len(res)), | ||
implementation=self._implementation, | ||
) | ||
) | ||
result = ser.__class__(range(len(ser)), name=ser.name, index=ser.index).loc[ser] | ||
return self._from_native_series(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np.flatnonzero
doesn't play well with cudf - but it's actually not too bad to keep it dataframe-native 😎
if implementation is Implementation.CUDF: # pragma: no cover | ||
obj = obj.copy(deep=False) # type: ignore[attr-defined] | ||
obj.index = index # type: ignore[attr-defined] | ||
return obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cudf.Series doesn't have set_axis wtf
Damn that's a lot of red appearing in the notebook 🥲 |
😄 we'll get there - support is strong enough that use cases like Altair work, but if we expect people to do gradually more complex things with Narwhals, we should address this We'll get there, I think there's a small root cause that's causing many failures |
Test cudf.DataFrame if installed
We can't test it in CI (unless Nvidia sponsors us 😉 ), but we can at least run the tests manually on Kaggle notebooks once every whenever we feel like it, like this: https://www.kaggle.com/code/marcogorelli/testing-cudf-in-narwhals/notebook
Gradually fixing up the failing cuDF tests can then make for good sprint material - we're got a few coming up
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below.