-
Notifications
You must be signed in to change notification settings - Fork 68
feat: support Series.dot on a DataFrame input
#230
Changes from 4 commits
47bfeb9
9389250
594c587
f794ff6
e41e83d
2ed0960
48975b4
049a869
b240f9c
403b66f
c82e553
f49385a
b92b872
a139e66
9545c45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,6 +680,17 @@ def rdivmod(self, other) -> Tuple[Series, Series]: # type: ignore | |
| return (self.rfloordiv(other), self.rmod(other)) | ||
|
|
||
| def __matmul__(self, other): | ||
| if isinstance(other, bigframes.dataframe.DataFrame): | ||
| return Series( | ||
| [ | ||
| pandas.NA if other[col].isna().any() else (self * other[col]).sum() | ||
| for col in other.columns | ||
| ], | ||
| index=other.columns, | ||
| name=self.name, | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will perform several queries, as each aggregate
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sent an optimization, PTAL. It doesn't apply to multi-index yet due to b/313747368, left a TODO.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the latest version only the multi-level columns operand implementation is inefficient (which should be a less common use case). Hope we can accept it for now. |
||
|
|
||
| # At this point other must be a Series | ||
| return (self * other).sum() | ||
|
|
||
| dot = __matmul__ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.