[
https://issues.apache.org/jira/browse/BEAM-11542?focusedWorklogId=537984&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-537984
]
ASF GitHub Bot logged work on BEAM-11542:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Jan/21 18:54
Start Date: 19/Jan/21 18:54
Worklog Time Spent: 10m
Work Description: robertwb commented on a change in pull request #13637:
URL: https://github.com/apache/beam/pull/13637#discussion_r560405869
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -1503,10 +1506,32 @@ def unstack(self, *args, **kwargs):
@populate_not_implemented(pd.core.groupby.generic.DataFrameGroupBy)
class DeferredGroupBy(frame_base.DeferredFrame):
- def __init__(self, expr, kwargs):
+ def __init__(self, expr, kwargs,
+ ungrouped: DeferredDataFrameOrSeries, projection=None):
super(DeferredGroupBy, self).__init__(expr)
+ # This object represents the result of:
+ # ungrouped.groupby(level=list(range(ungrouped.index.nlevels),
+ # **kwargs)[projection]
+ self._ungrouped = ungrouped
+ self._projection = projection
self._kwargs = kwargs
+ def __getattr__(self, name):
+ return DeferredGroupBy(expressions.ComputedExpression(
+ 'groupby_project',
+ lambda gb: getattr(gb, name), [self._expr],
+ requires_partition_by=partitionings.Nothing(),
+ preserves_partition_by=partitionings.Singleton()),
+ self._kwargs, self._ungrouped, name)
Review comment:
This indentation seems odd. Perhaps add a newline after the
DeferredGroupBy above?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 537984)
Time Spent: 1h 20m (was: 1h 10m)
> Support projecting groupbys
> ---------------------------
>
> Key: BEAM-11542
> URL: https://issues.apache.org/jira/browse/BEAM-11542
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Brian Hulette
> Priority: P2
> Labels: dataframe-api
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> For example: df.groupby('foo').bar.sum(), or df.groupby('foo')['bar'].sum()
--
This message was sent by Atlassian Jira
(v8.3.4#803005)