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]