-
Notifications
You must be signed in to change notification settings - Fork 21
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
Bad developer experience - df.__dataframe_namespace__()
is untyped
#258
Comments
This indeed would be nice to improve for devs who rely on code completion in IDEs. I'll note that the same problem for |
One other thought: for any concrete implementation I think this is a non-issue, because they should be returning a regular Python module rather than |
The issue I was thinking of is the one which will be faced by developers trying to use the dataframe api to write dataframe-agnostic code Say I'm writing a package from typing import Protocol, Any
from dataframe_api import DataFrame
class SupportsAPIStandard(Protocol):
def __dataframe_consortium_standard__(
self, *, api_version: str | None = None
) -> DataFrame:
...
def min_max_scaler(df_raw: SupportsAPIStandard) -> Any:
df= df_raw.__dataframe_consortium_standard__()
namespace = df.__dataframe_namespace__()
col = namespace.col
df = df.update_columns(*[
(col(column_name) - col(column_name).min()) / (col(column_name).max() - col(column_name).min())
])
return df.dataframe All I know about the input
But for And I can't use the type hints from a concrete implementation, because by definition of the exercise I'm trying to write a dataframe-agnostic function (so, I can't annotate it as I'll take a look at the array api PR, thanks! |
Thanks for spelling that out. It all makes sense to me, and I think the array API namespace type hinting solution will help (and is much easier to apply here, because we have very few free functions in the dataframe API standard). |
closed by #267 |
The developer experience of using the api could be improved (to put it mildly) - I'll give a demo
If I stick to dataframe methods, then it's all typed and so I get nice suggestions from my IDE:
But if I try getting the namespace out, I don't get any suggestions, because
__dataframe_namespace__()
is typed to returnAny
Before I make suggestions, can we agree that this is a bad developer experience and that it needs fixing?
The text was updated successfully, but these errors were encountered: