[
https://issues.apache.org/jira/browse/BEAM-9547?focusedWorklogId=561020&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-561020
]
ASF GitHub Bot logged work on BEAM-9547:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Mar/21 17:19
Start Date: 04/Mar/21 17:19
Worklog Time Spent: 10m
Work Description: TheNeuralBit commented on a change in pull request
#14140:
URL: https://github.com/apache/beam/pull/14140#discussion_r587665489
##########
File path: sdks/python/apache_beam/dataframe/pandas_doctests_test.py
##########
@@ -411,6 +411,96 @@ def test_indexing_tests(self):
})
self.assertEqual(result.failed, 0)
+ def test_groupby_tests(self):
+ result = doctests.testmod(
+ pd.core.groupby.groupby,
+ use_beam=False,
+ wont_implement_ok={
+ 'pandas.core.groupby.groupby.GroupBy.head': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.tail': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.nth': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.cumcount': ['*'],
+ },
+ not_implemented_ok={
+ 'pandas.core.groupby.groupby.GroupBy.describe': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.ngroup': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.resample': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.sample': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.resample': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.quantile': ['*'],
+ 'pandas.core.groupby.groupby.BaseGroupBy.pipe': ['*'],
+ 'pandas.core.groupby.groupby.GroupBy.nth': [
+ "df.groupby('A', as_index=False).nth(1)",
+ ],
+ },
+ skip={
+ # Uses iloc to mutate a DataFrame
+ 'pandas.core.groupby.groupby.GroupBy.resample': [
+ 'df.iloc[2, 0] = 5',
+ 'df',
+ ],
+ # TODO: Raise wont implement for list passed as a grouping column
+ # Currently raises unhashable type: list
+ 'pandas.core.groupby.groupby.GroupBy.ngroup': [
+ 'df.groupby(["A", [1,1,2,3,2,1]]).ngroup()'
+ ],
+ })
+ self.assertEqual(result.failed, 0)
+
+ result = doctests.testmod(
+ pd.core.groupby.generic,
+ use_beam=False,
+ wont_implement_ok={
+ # Returns an array by default, not a Series. WontImplement
+ # (non-deferred)
+ 'pandas.core.groupby.generic.SeriesGroupBy.unique': ['*'],
+ # TODO: Is take actually deprecated?
+ 'pandas.core.groupby.generic.DataFrameGroupBy.take': ['*'],
+ 'pandas.core.groupby.generic.SeriesGroupBy.take': ['*'],
+ 'pandas.core.groupby.generic.SeriesGroupBy.nsmallest': [
+ "s.nsmallest(3, keep='last')",
Review comment:
1. Correct, except these are generally references to methods and their
docstrings. It's implemented here:
https://github.com/apache/beam/blob/05f520074b3a456f2ecf5df44f1602ca14bcb415/sdks/python/apache_beam/dataframe/doctests.py#L316-L320
2. Yeah I was confused by this too. It looks like some of these docstrings
aren't actually testing the thing they say they do. Presumably due to some
inheritance structure? It may behoove us to help clean up some of these
examples upstream. (e.g. I just sent
https://github.com/pandas-dev/pandas/pull/40207 for groupby.apply)
----------------------------------------------------------------
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: 561020)
Time Spent: 45h (was: 44h 50m)
> Implement all pandas operations (or raise WontImplementError)
> -------------------------------------------------------------
>
> Key: BEAM-9547
> URL: https://issues.apache.org/jira/browse/BEAM-9547
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Robert Bradshaw
> Priority: P2
> Labels: dataframe-api
> Time Spent: 45h
> Remaining Estimate: 0h
>
> We should have an implementation for every DataFrame, Series, and GroupBy
> method. Everything that's not possible to implement should get a default
> implementation that raises WontImplementError
> SeeĀ https://github.com/apache/beam/pull/10757#discussion_r389132292
> Progress at the individual operation level is tracked in a
> [spreadsheet|https://docs.google.com/spreadsheets/d/1hHAaJ0n0k2tw465ORs5tfdy4Lg0DnGWIQ53cLjAhel0/edit],
> consider requesting edit access if you'd like to help out.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)