-
-
Notifications
You must be signed in to change notification settings - Fork 143
GH1248/GH1249 DataFrame.assign and MultiIndex.from_product Series/Index #1250
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
base: main
Are you sure you want to change the base?
Conversation
AnyArrayLike | Scalar | Callable[[DataFrame], AnyArrayLike | Scalar] | None | ||
AnyArrayLike | ||
| Scalar | ||
| Callable[[DataFrame], AnyArrayLike | Scalar | list[Scalar] | range] |
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.
| Callable[[DataFrame], AnyArrayLike | Scalar | list[Scalar] | range] | |
| Callable[[DataFrame], AnyArrayLike | Scalar | list[Scalar] | range] | | |
list[Scalar] | range |
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.
Addressed
tests/test_indexes.py
Outdated
mi = pd.MultiIndex.from_product([["x", "y"], df.columns]) | ||
mi = pd.MultiIndex.from_product([["x", "y"], pd.Series([1, 2])]) |
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.
can you add the check(assert_type(
pattern 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.
Fixed
tests/test_frame.py
Outdated
df = pd.DataFrame({"a": [1, 2, 3]}) | ||
check( | ||
assert_type( | ||
df.assign(b=lambda df: range(len(df)), c=lambda df: [10, 20, 30]), |
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 want to test df.assign(b=range(len(df)), c=[10,20,30])
5fd69f7
to
c118810
Compare
DataFrame.assign()
should allow a list and a range #1248 andMultiIndex.from_product()
should acceptIndex
orSeries
as arguments #1249assert_type()
to assert the type of any return value