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(python): Implement DataFrame Interchange Protocol through pyarrow #6581

Merged
merged 1 commit into from Jan 31, 2023

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jan 30, 2023

Follow-up of #5662

Resolves #2249

Utilizes pyarrow's implementation of the DataFrame interchange protocol. Many thanks to @jorisvandenbossche and the pyarrow team for their work on this.

Changes:

  • Add DataFrame.__dataframe__ for converting to the interchange format
  • Add pl.from_dataframe for converting from the interchange format

Limitations:

  • pyarrow>=11.0.0 is required
  • Cannot convert categoricals to pyarrow in a zero-copy manner. This will throw a NotImplementedError, indicating that we do not currently offer this, but are planning to in the future (either through better pyarrow integration, or utilizing our own implementation of the protocol).
  • Cannot utilize from_dataframe in a zero-copy manner. This will throw a NotImplementedError. We can refine this later by detecting which dtypes are present in the dataframe and determining if those can be handled in a zero-copy manner.

So while there are some (significant) limitations on zero-copy conversions, we can now support the dataframe interchange protocol!

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jan 30, 2023
@stinodego stinodego changed the title feat(python): Implement DataFrame Interchange Protocol through pyarrow feat(python): Implement DataFrame Interchange Protocol through pyarrow Jan 30, 2023
@ritchie46
Copy link
Member

That's easy. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-interchange Area: Python dataframe interchange protocol enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the Array API
2 participants