Skip to content

Adds stub of NarwhalsAdapter#998

Merged
skrawcz merged 7 commits into
mainfrom
narwhals_example
Jul 2, 2024
Merged

Adds stub of NarwhalsAdapter#998
skrawcz merged 7 commits into
mainfrom
narwhals_example

Conversation

@skrawcz

@skrawcz skrawcz commented Jun 28, 2024

Copy link
Copy Markdown
Contributor

The purpose of this adapter is to showcase how you can write
transforms that are agnostic of the dataframe type.

Notes

Assumptions narwhals has (I believe):

  1. you can only have one "backend"; you can't mix & match. That means you can't load some in pandas, and some in polars I don't think.
  2. This change uses the narwhals decorator. This assumes that non pandas/polars stuff would be left alone by it. If not, we could just skip adding it if we don't detect a type.
  3. I think this is a good enough integration to get out -- we'll likely tweak/add more functionality as feedback comes in.

Changes

  • adds narwhals plugin

How I tested this

  • locally
  • via integration test

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@skrawcz
skrawcz marked this pull request as ready for review July 1, 2024 18:33
@skrawcz
skrawcz force-pushed the narwhals_example branch 2 times, most recently from 2c21576 to de1af35 Compare July 2, 2024 00:55
skrawcz added 5 commits July 1, 2024 20:57
Assumptions narwhals has (I believe):
1. you can only have one "backend"; you can't mix & match.
That means you can't load some in pandas, and some in polars
I don't think.
2. This change uses the narwhals decorator. This assumes
that non pandas/polars stuff would be left alone by it.
If not, we could just skip adding it if we don't detect
a type.

Otherwise probably need a better example from narhwals.
This makes the user choose what the return type
is and then requires them to nest it in the
narwhals result builder that just converts
the outputs to the backend that is being used.
First version of narwhals support.
Adds README and notebook so that people can run
this example easily.

Also adds circleci tests.
@skrawcz
skrawcz force-pushed the narwhals_example branch from de1af35 to 00e2737 Compare July 2, 2024 03:59
@skrawcz
skrawcz merged commit 096d210 into main Jul 2, 2024
@skrawcz
skrawcz deleted the narwhals_example branch July 2, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant