tvalentyn commented on a change in pull request #14140:
URL: https://github.com/apache/beam/pull/14140#discussion_r587901043
##########
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:
I see. This explains it:
```
In [10]: pandas.core.groupby.generic.SeriesGroupBy.nsmallest.__doc__ ==
pandas.core.series.Series.nsmallest.__doc__
Out[10]: True
```
I hope you don't have to deal with too many exclusions of the same method
due to inheritance. A smarter match might help avoid repeats but perhaps not
warranted now.
----------------------------------------------------------------
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]