TheNeuralBit commented on a change in pull request #15773:
URL: https://github.com/apache/beam/pull/15773#discussion_r741336462
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -1500,6 +1500,23 @@ def dropna(self, **kwargs):
preserves_partition_by=partitionings.Arbitrary(),
requires_partition_by=partitionings.Arbitrary()))
+ @frame_base.with_docs_from(pd.Series)
+ @frame_base.args_to_kwargs(pd.Series)
+ @frame_base.populate_defaults(pd.Series)
+ @frame_base.maybe_inplace
+ def set_axis(self, labels, **kwargs):
+ index = pd.Index([], dtype=np.asarray(labels).dtype)
+ proxy = self._expr.proxy().copy()
+ proxy.index = index
+ with expressions.allow_non_parallel_operations(True):
+ return frame_base.DeferredFrame.wrap(
+ expressions.ComputedExpression(
+ 'set_axis',
+ lambda s: s.set_axis(labels, **kwargs), [self._expr],
+ proxy=proxy,
+ requires_partition_by=partitionings.Singleton(),
+ preserves_partition_by=partitionings.Singleton()))
Review comment:
`Series.set_axis` is the same as `DataFrame.set_axis` with `axis=index`
(since there are no column names to assign). So this method should always raise
like the latter.
--
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]