-
-
Notifications
You must be signed in to change notification settings - Fork 141
Added ArrayLike In Series.clip #443
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
tests/test_series.py
Outdated
assert_type((s.clip(upper=s)), "pd.Series[Any]"), pd.Series[Any], pd.Series[Any] | ||
) | ||
check( | ||
assert_type((s.clip(lower=s)), "pd.Series[Any]"), pd.Series[Any], pd.Series[Any] |
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.
You can do assert_type(s.clip(lower=s), pd.Series), pd.Series)
here
Also, remove the extra parentheses around the calls to s.clip()
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.
You can do
assert_type(s.clip(lower=s), pd.Series), pd.Series)
here
Are you sujjesting assert_type((s.clip(lower=s), pd.Series), pd.Series)
or assert_type(s.clip(lower=s), pd.Series)
, but in both cases mypy fails
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.
Use check
with assert_type
and use AnyArrayLike
not ArrayLike
You are going to have to start figuring out these things by yourself. Look at the error messages and debug the code.
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.
done with the changes didn't add check because it was giving TypeError.
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.
You are going to have to start figuring out these things by yourself. Look at the error messages and debug the code.
yes sir, looking forward to spend my time with errors
tests/test_series.py
Outdated
def test_AnyArrayLike_and_clip() -> None: | ||
ser = pd.Series([1, 2, 3, 4]) | ||
assert_type(ser.clip(upper=ser), pd.Series) | ||
assert_type(ser.clip(lower=ser), pd.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.
have to do check
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.
ok 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.
sir can you please check the recent commit. the test are wrong I read on internet about TypeError, tried myself but could not fix it
tests/test_series.py
Outdated
s1=ser.clip(upper=ser) | ||
s2=ser.clip(upper=ser) | ||
check(assert_type(s1, pd.Series), pd.Series, pd.Series[Any]) | ||
check(assert_type(s2, pd.Series), pd.Series, pd.Series[Any]) |
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.
check(assert_type(s2, pd.Series), pd.Series)
If you know the type of the object inside the Series
, then you do check(assert_type(s2, pd.Series), pd.Series, float)
(for example). But here we don't know the type, so we just leave out that last argument to check
.
Look at the code for check
to see how it works
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 sir read the check
code
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
thanks sir |
assert_type()
to assert the type of any return valueSir can you please check the tests.