-
Notifications
You must be signed in to change notification settings - Fork 170
refactor: *(Namespace|DataFrame).from_numpy
#2283
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
154dc54
feat: Define `CompliantDataFrame.from_numpy`
dangotbanned 3d533a0
feat: Add `PolarsDataFrame.from_numpy`
dangotbanned b333351
fix: Align `to_numpy` signatures
dangotbanned 4805551
feat: Add `ArrowDataFrame.from_numpy`
dangotbanned c689161
refactor: Simplify `polars` impl
dangotbanned b63fa86
feat: Add `PandasLikeDataFrame.from_numpy`
dangotbanned d0e36f3
fix: Use `TypeVar` defaults correctly?
dangotbanned 1591c2d
feat: Add `Implementation._to_compliant_namespace`
dangotbanned c5500a3
chore: Make `PolarsNamespace.concat` compliant
dangotbanned 39382c5
chore(typing): Fill in more `__getattr__` gaps
dangotbanned 7cd9ca7
chore: start aligning `PolarsSelectorNamespace`
dangotbanned aca796a
chore(typing): Pragmatic solution for `PolarsNamespace.selectors`
dangotbanned 7101b62
feat(typing): Add `EagerNamespace._dataframe`
dangotbanned 91bd274
feat: Add `PolarsNamespace._dataframe`
dangotbanned 7f9fb6b
feat: Implement `EagerNamespace.from_numpy`
dangotbanned 0c6a484
feat: Add `PolarsNamespace.from_numpy`
dangotbanned 4f99e2d
chore: add `version` to `_from_numpy_impl`
dangotbanned 14fe87f
feat(typing): `_to_compliant_namespace` overloads
dangotbanned 7749bcd
feat(typing): Add `is_(eager|lazy)_allowed` guards
dangotbanned d52b405
refactor: Rewrite `from_numpy` using new protocols
dangotbanned bbc8a3d
remove duplicate overload
dangotbanned b3c791f
ignore `mypy` for now
dangotbanned 2d49da4
Merge remote-tracking branch 'upstream/main' into from-numpy-2d-ns
dangotbanned b076950
fix: Un-confuse `mypy`
dangotbanned 36c6b19
refactor(typing): Make aliases readable
dangotbanned 50a39df
refactor: validate `schema` before passing to `Compliant*`
dangotbanned 0273426
test: remove `xfail` from lazy backends
dangotbanned 4e8591a
refactor: Add `EagerDataFrame._numpy_column_names`
dangotbanned 694960d
refresh ci
dangotbanned f07cf38
ignore coverage on future stuff
dangotbanned 31a5259
Merge remote-tracking branch 'upstream/main' into from-numpy-2d-ns
dangotbanned 7a137b3
Merge branch 'main' into from-numpy-2d-ns
dangotbanned dabe5d4
Merge branch 'main' into from-numpy-2d-ns
dangotbanned 8770d37
Merge branch 'main' into from-numpy-2d-ns
dangotbanned 60a5469
Merge branch 'main' into from-numpy-2d-ns
dangotbanned fc74ba1
Merge branch 'main' into from-numpy-2d-ns
dangotbanned 0e67a1e
fix(typing): Satisfy `pyright` in `PolarsNamespace.concat`
dangotbanned 4f1b172
Merge remote-tracking branch 'upstream/main' into from-numpy-2d-ns
dangotbanned File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves (#2283 (comment)) via (0e67a1e)
@MarcoGorelli
I had no idea a
TypeVarcould be used this way π€One rule I thought was that a
TypeVaron a parameter annotation must either:Generic[T]orProtocol[T])narwhals/narwhals/_polars/typing.py
Line 21 in 4f1b172
FrameTdoesn't meet either of those rules - so I'd have expected this to get rejected.But why work??
My best guess is there seems to be an understanding of what
FrameTrepresents - and how that is consistent with:narwhals/narwhals/_compliant/namespace.py
Lines 72 to 77 in 4f1b172
narwhals/narwhals/_compliant/typing.py
Line 74 in 4f1b172
narwhals/narwhals/_compliant/typing.py
Lines 40 to 42 in 4f1b172