[
https://issues.apache.org/jira/browse/BEAM-12563?focusedWorklogId=692746&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-692746
]
ASF GitHub Bot logged work on BEAM-12563:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Dec/21 17:31
Start Date: 08/Dec/21 17:31
Worklog Time Spent: 10m
Work Description: TheNeuralBit commented on a change in pull request
#15944:
URL: https://github.com/apache/beam/pull/15944#discussion_r765077294
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -228,6 +228,16 @@ def droplevel(self, level, axis):
preserves_partition_by=partitionings.Arbitrary()
if axis in (1, 'column') else partitionings.Singleton()))
+ @frame_base.with_docs_from(pd.DataFrame)
+ @frame_base.args_to_kwargs(pd.DataFrame)
+ def swaplevel(self, **kwargs):
+ return frame_base.DeferredFrame.wrap(
+ expressions.ComputedExpression(
+ 'swaplevel',
+ lambda df: df.swaplevel(**kwargs), [self._expr],
+ requires_partition_by=partitionings.Arbitrary(),
+ preserves_partition_by=partitionings.Arbitrary()))
Review comment:
I wouldn't think this should preserve Index partitioning, since it
modifies the index. But our test framework does verify this.
It turns out this expression _does_ preserve index partitioning, since we
generate hashes by summing hashes on the individual index levels, which is
independent of the order of the index levels.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 692746)
Time Spent: 3h 40m (was: 3.5h)
> Implement swaplevel for Series and DataFrame
> --------------------------------------------
>
> Key: BEAM-12563
> URL: https://issues.apache.org/jira/browse/BEAM-12563
> Project: Beam
> Issue Type: Improvement
> Components: dsl-dataframe
> Reporter: Brian Hulette
> Assignee: Irwin Alejandro Rodirguez Ramirez
> Priority: P3
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> Add an implementation of
> [swaplevel|https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.swaplevel.html]
> for DeferredDataFrame, DeferredSeries, and DeferredGroupBy. It should be
> fully unit tested with some combination of pandas_doctests_test.py and
> frames_test.py.
> https://github.com/apache/beam/pull/14274 is an example of a typical PR that
> adds new operations. See
> https://lists.apache.org/thread.html/r8ffe96d756054610dfdb4e849ffc6a741e826d15ba7e5bdeee1b4266%40%3Cdev.beam.apache.org%3E
> for background on the DataFrame API.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)