[
https://issues.apache.org/jira/browse/BEAM-12566?focusedWorklogId=674194&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-674194
]
ASF GitHub Bot logged work on BEAM-12566:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Nov/21 21:50
Start Date: 02/Nov/21 21:50
Worklog Time Spent: 10m
Work Description: 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]
Issue Time Tracking
-------------------
Worklog Id: (was: 674194)
Time Spent: 3h 10m (was: 3h)
> Implement set_axis for DataFrame and Series
> -------------------------------------------
>
> Key: BEAM-12566
> URL: https://issues.apache.org/jira/browse/BEAM-12566
> Project: Beam
> Issue Type: Improvement
> Components: dsl-dataframe
> Reporter: Brian Hulette
> Assignee: Benjamin Gonzalez
> Priority: P3
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> Add an implementation of
> [set_axis|https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_axis.html]
> for DeferredDataFrame and DeferredSeries. 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.3.4#803005)