-
Notifications
You must be signed in to change notification settings - Fork 121
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
docs: add from/to_native
in documentation examples
#1461
Conversation
```python | ||
import narwhals.stable.v1 as nw | ||
from narwhals.typing import FrameT | ||
=== "from/to_native" |
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.
I called this tab from/to_native
everywhere - let's figure out a better title
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.
nice, really like this - just left a really minor comment on types
from narwhals.typing import DataFrameT | ||
|
||
|
||
@nw.narwhalify(eager_only=True) | ||
def func(df: nw.DataFrame[Any], s: nw.Series, col_name: str) -> int: | ||
def func(df: DataFrameT, s: nw.Series, col_name: str) -> int: |
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.
should we be using a TypeVar when it's only used in one place? I think this one might be better staying as nw.DataFrame[Any]
?
def my_func(df: nw.DataFrame) -> float | None: | ||
return df["a"].mean() | ||
``` | ||
def my_func(df: IntoDataFrameT) -> float | None: |
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.
same comment about typevar
|
||
|
||
@nw.narwhalify(eager_only=True) | ||
def my_func(df: DataFrameT) -> float | None: |
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.
same
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.
thanks @FBruzzesi
sorry, updating my verdict on typevars, if mypy doesn't complain then I shouldn't be bothering with commenting on it in reviews
Feel free to merge if you're happy with the "from/to_native"
title (personally I think it's good)
What type of PR is this? (check all applicable)
Related issues
narwhalify
in the tutorial?Β #1372Checklist
If you have comments or can explain your changes, please do so below
Adds both options in all the documentation examples by using tabs