-
Notifications
You must be signed in to change notification settings - Fork 358
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
Implement DataFrame.dot supporting Series parameter #1945
Conversation
1823278
to
1cb3e48
Compare
Codecov Report
@@ Coverage Diff @@
## master #1945 +/- ##
==========================================
- Coverage 94.64% 94.62% -0.02%
==========================================
Files 49 49
Lines 10831 10834 +3
==========================================
+ Hits 10251 10252 +1
- Misses 580 582 +2
Continue to review full report at Codecov.
|
if not isinstance(other, ks.Series): | ||
raise TypeError("Unsupported type {}".format(type(other).__name__)) |
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.
Seems pandas also support many other types as below, not only Series
if they are "aligned".
For example,
>>> pdf
0 1 2 3
0 0 1 -2 -1
1 1 1 1 1
>>> pser
0 1
1 1
2 2
3 1
dtype: int64
>>> pdf.dot(pser.to_frame()) # DataFrame
0
0 -4
1 5
>>> pdf.dot(pser.index) # Index
0 -6
1 6
dtype: int64
>>> pdf.dot([1, 2, 3, 4]) # list
0 -8
1 10
dtype: int64
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.
Yeah, I should've clarified in the PR description. This PR targets to support other as Series
only.
Considering the implementation complexity and user demand, we might want to support other data types later.
Let me modify the PR description and leave a comment for this.
Thanks for looking into this!
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.
Oh, sure I got it :)
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.
LGTM.
Thanks! merging. |
Compute the matrix multiplication between the DataFrame and other series only.