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

test: Add cudf_constructor to conftest #797

Merged
merged 8 commits into from
Aug 16, 2024

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Aug 15, 2024

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)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

  • Related issue #
  • Closes #

Checklist

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

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

@MarcoGorelli MarcoGorelli marked this pull request as ready for review August 15, 2024 20:27
@MarcoGorelli MarcoGorelli changed the title Add cudf_constructor to conftest test: Add cudf_constructor to conftest Aug 15, 2024
Comment on lines -224 to +226
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)
Copy link
Member Author

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 😎

Comment on lines +200 to +203
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
Copy link
Member Author

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

@FBruzzesi
Copy link
Member

Damn that's a lot of red appearing in the notebook 🥲

@MarcoGorelli
Copy link
Member Author

😄 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

@MarcoGorelli MarcoGorelli merged commit dec35e5 into narwhals-dev:main Aug 16, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants