-
Notifications
You must be signed in to change notification settings - Fork 20
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
from_dataframe: only interchange supported columns? #288
Comments
In my opinion, that seems to be working as expected given we don't yet support data types like Selecting the relevant columns to interchange seems like something that should either be done using the library specific API or using the API standard we're working on? |
selecting columns can be done with in theory it is working as expected, it's just a pity to see a library introduce a regression when they move from |
You can't select columns in the actual |
I would also say that this is the responsibility of the user of the interchange protocol (i.e. in this case seaborn) to first select the columns it needs before converting (which is also useful for other reasons, eg because the conversion can be costly). I think silently dropping columns in the conversion can also be confusing / lead to corner cases. Assume someone passes a polars dataframe to seaborn and specifies |
Maybe we didn't really define it (and it would be good to do so), but my assumption is that |
In that case, say you have a library specific dataframe with an unsupported dtype like
|
I'd suggest that both
I think we indeed didn't define anything beyond "nested data types are unsupported". And I suspect Joris is right that it'd be better to allow this - failing later will make it easier to write more generic code here. |
columns = list(necessary_columns)
df = pd.api.interchange.from_dataframe(
df.__dataframe__().select_columns_by_name(columns)
) |
I think throwing on unsupported dtype columns in the |
I just wanted to raise this here mwaskom/seaborn#3533
Try to plot a polars dataframe with a list column raises, even if that column wouldn't have been plotted
Arguably this the issue is that seaborn is trying to convert all columns, rather than only the ones it needs
But still, wondering if there's a solution here - like, that from_dataframe only converts columns if they're of a supported data type, rather than raising. Maybe we could add an option for this in the pandas from_dataframe method, and note that it's technically not part of the protocol
The text was updated successfully, but these errors were encountered: