TheNeuralBit commented on a change in pull request #14487:
URL: https://github.com/apache/beam/pull/14487#discussion_r612765867
##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -640,6 +646,26 @@ def change_index_names(df):
self._run_test(change_index_names, df)
+ @parameterized.expand((x, ) for x in [
+ 0,
+ [1],
+ 3,
+ [0, 3],
+ [2, 1],
+ ['foo', 0],
+ [1, 'str'],
+ [3, 0, 2, 1],
+ ])
+ def test_groupby_level_agg(self, level):
Review comment:
This does use a MultiIndex, the `set_index` call below copies several
columns into a MultiIndex:
```py
In [1]: from apache_beam.dataframe.frames_test import GROUPBY_DF
In [2]: GROUPBY_DF.set_index(['group', 'foo', 'bar', 'str'], drop=False)
Out[2]:
group foo bar baz bool str
group foo bar str
a NaN NaN 0 a NaN NaN NaN True 0
b 1.0 98.0 1 b 1.0 98.0 2.0 False 1
2.0 97.0 2 b 2.0 97.0 4.0 False 2
a 3.0 96.0 3 a 3.0 96.0 6.0 False 3
b 4.0 95.0 4 b 4.0 95.0 8.0 False 4
... ... ... ... ... ... ..
a 95.0 4.0 95 a 95.0 4.0 190.0 False 95
96.0 3.0 96 a 96.0 3.0 192.0 False 96
b 97.0 2.0 97 b 97.0 2.0 194.0 False 97
98.0 NaN 98 b 98.0 NaN 196.0 False 98
a NaN 0.0 99 a NaN 0.0 198.0 False 99
[100 rows x 6 columns]
```
--
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]