-
-
Notifications
You must be signed in to change notification settings - Fork 143
Changed SeriesGroupBy to return Series #445
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
Conversation
ascending: bool = ..., | ||
bins=..., | ||
dropna: bool = ..., | ||
) -> Series: ... |
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.
Why do we need two overloads?
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 not need two overloads when both return Series
.
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 updated the file thanks
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.
Actually there should be two overloads here, and I realized this after merging. @ramvikrams can you open a new PR with this:
@overload
def value_counts(
self,
normalize: Literal[False] = ...,
sort: bool = ...,
ascending: bool = ...,
bins=...,
dropna: bool = ...,
) -> Series[int]: ...
@overload
def value_counts(
self,
normalize: Literal[True]
sort: bool = ...,
ascending: bool = ...,
bins=...,
dropna: bool = ...,
) -> Series[float]: ...
The changes from what you initially had are not doing = ...
for normalize
in the second overload, and adding the subtype as the return type of the two overloads.
In the test, don't do c: pd.Series =
, and modify the test to check that it returns Series[int]
, and then add a test with normalize=True
and check thtat it returns Series[float]
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.
yes sir will do that
tests/test_frame.py
Outdated
@@ -1942,3 +1942,14 @@ def series_added_in_astype() -> None: | |||
# GH410 | |||
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) | |||
check(assert_type(df.astype(df.dtypes), pd.DataFrame), pd.DataFrame) | |||
|
|||
|
|||
def test_SeriesGroupBy_and_value_conts() -> 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.
There is a typo here. And why is it in frame tests? There are no similar tests to put it with?
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.
Also, please use standard python function naming, e.g., test_series_groupby_and_value_counts
.
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.
yes sir
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 @ramvikrams
IN the future, please name your branches related to what you are fixing
ok sir will surely do that |
sorry @Dr-Irv , I'm confused - shouldn't overloads have been added to return |
Yes, and I think I was typing the same message while you were typing yours! |
Series
notDataFrame
#442assert_type()
to assert the type of any return value