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: raise informative error or warning when passing narwhals object to nw.dependencies.is_*_dataframe #1437

Open
MarcoGorelli opened this issue Nov 23, 2024 · 0 comments · May be fixed by #1444
Labels
enhancement New feature or request help wanted Extra attention is needed Medium priority

Comments

@MarcoGorelli
Copy link
Member

If someone has a df: nw.DataFrame and they do

nw.dependencies.is_pandas_dataframe(df)

then they almost certainly meant to call

nw.dependencies.is_pandas_dataframe(df.to_native())

Source: I made this mistake 😳

To save others from making this mistake (as well as to save myself from re-making it in the future), we could:

  • raise an error
  • always raise a warning

Maybe just raising an error would be fine, I can't imagine a situation where you have an object which is either a narwhals dataframe or a native object and in both cases you pass it as-is to is_pandas_dataframe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed Medium priority
Projects
None yet
1 participant