-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
GH1055 Add pandas.api.typing to pandas-stubs #1058
Conversation
80fbecf
to
0d8e262
Compare
Haven't written tests for every case, I first want to get feedback on the structure and if I am going the right direction. |
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.
If we can't do assert_type
on the pandas.api.typing
objects, then we may have to change the stubs to support that.
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.
So this structure is fine. Now you need to add tests for all of the other things in pandas.api.typing
So I see that your tests failed and I played around with it. The purpose of the types in def test_dataframegroupby():
df = pd.DataFrame({"a": [1, 2, 3]})
group = df.groupby("a")
def f1(gb: DataFrameGroupBy):
check(group, DataFrameGroupBy)
f1(group) We can't use the You'd only have to do this for the ones that are |
Thanks for the trick here! |
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.
one small change to use TypeAlias
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 @loicdiridollou
assert_type()
to assert the type of any return value