[
https://issues.apache.org/jira/browse/BEAM-12018?focusedWorklogId=591307&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-591307
]
ASF GitHub Bot logged work on BEAM-12018:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Apr/21 23:43
Start Date: 29/Apr/21 23:43
Worklog Time Spent: 10m
Work Description: TheNeuralBit commented on a change in pull request
#14689:
URL: https://github.com/apache/beam/pull/14689#discussion_r623495017
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -578,6 +578,22 @@ def _get_index(self):
requires_partition_by=partitionings.Arbitrary(),
preserves_partition_by=partitionings.Singleton())
+ @frame_base.args_to_kwargs(pd.DataFrame)
+ @frame_base.populate_defaults(pd.DataFrame)
+ def melt(self, ignore_index, **kwargs):
+ if ignore_index:
+ raise frame_base.WontImplementError(
+ "melt(ignore_index=True) is order sensitive because it requires "
+ "generating a new index based on the order of the data.",
+ reason="order-sensitive")
+
+ return frame_base.DeferredFrame.wrap(
+ expressions.ComputedExpression(
+ 'melt',
+ lambda df: df.melt(ignore_index=False, **kwargs), [self._expr],
+ requires_partition_by=partitionings.Arbitrary(),
+ preserves_partition_by=partitionings.Singleton()))
+
Review comment:
Ah sorry I just noticed that this method is on
`DeferredDataFrameOrSeries`. But we don't want to define this on
`DeferredSeries`, just on `DeferredDataFrame`. (Since pandas only supports it
on DataFrames)
Could you move the method there?
--
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: 591307)
Time Spent: 3h 20m (was: 3h 10m)
> Implement melt for DataFrame
> ----------------------------
>
> Key: BEAM-12018
> URL: https://issues.apache.org/jira/browse/BEAM-12018
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Rogelio Miguel Hernandez Sandoval
> Priority: P3
> Labels: dataframe-api
> Time Spent: 3h 20m
> Remaining Estimate: 0h
>
> Add an implementation for
> [melt|https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.melt.html]
> that works for DeferredDataFrame, and is 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)