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

ENH: add consortium standard entrypoint #54383

Merged
merged 12 commits into from
Aug 7, 2023

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Aug 3, 2023

Here's an entry point to the Consortium's DataFrame API Standard

It enables dataframe-consuming libraries to just check for a __dataframe_consortium_standard__ attribute on a dataframe they receive - then, so long as they stick to the spec defined in https://data-apis.org/dataframe-api/draft/index.html, then their code should work the same way, regardless of what the original backing dataframe library was

Use-case: currently, scikit-learn is very keen on using this, as they're not keen on having to depend on pyarrow (which will become required in pandas), and the interchange protocol only goes so far (e.g. a way to convert to ndarray is out-of-scope for that). If we can get this to work there, then other use cases may emerge

The current spec should be enough for scikit-learn, and having this entry point makes it easier to move forwards with development (without monkey-patching / special-casing)

For reference, polars has already merged this: pola-rs/polars#10244

Maintenance burden on pandas

None

I want to be very clear about this: the compat package will be developed, maintained, and tested by the consortium and community of libraries which use it. It is up to consuming libraries to set a minimum version of the dataframe-api-compat package. No responsibility will land on pandas maintainers. If any bugs are reported to pandas, then they can (and should) be politely closed.
All this is just an entry point to the Consortium's Standard

Tagging @pandas-dev/pandas-core for visibility. Some people raised objections (maintenance burden, naming) when asked in private, and I think I've addressed the concerns. Anything else?
Thanks 🙌

@MarcoGorelli MarcoGorelli marked this pull request as ready for review August 3, 2023 10:38
@jbrockmendel
Copy link
Member

No objections here.

Copy link
Member

@lithomas1 lithomas1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to the docs as an optional dependency?
(I assume we'll want a minimum version of the standard at some point)

@lithomas1 lithomas1 added this to the 2.1 milestone Aug 3, 2023
@mroeschke mroeschke added the Interchange Dataframe Interchange Protocol label Aug 3, 2023
Copy link
Member

@lithomas1 lithomas1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now.
Can you add a whatsnew too in 2.1.0 saying that pandas supports the consortium or something like that too?

@lithomas1 lithomas1 dismissed their stale review August 4, 2023 16:00

changes addressed

@MarcoGorelli MarcoGorelli added the Build Library building on various platforms label Aug 7, 2023
@mroeschke mroeschke merged commit 809f371 into pandas-dev:main Aug 7, 2023
70 checks passed
@mroeschke
Copy link
Member

Thanks @MarcoGorelli

mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
* add consortium standard entrypoint

* add dataframe-api-compat to optional dependencies, add to test_downstream

* align

* use importorskip

* mypy

* fixup table in docs

* whatsnew

* add check to package-checks.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms Interchange Dataframe Interchange Protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants