[
https://issues.apache.org/jira/browse/BEAM-11628?focusedWorklogId=544549&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-544549
]
ASF GitHub Bot logged work on BEAM-11628:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Jan/21 23:01
Start Date: 29/Jan/21 23:01
Worklog Time Spent: 10m
Work Description: TheNeuralBit commented on a change in pull request
#13843:
URL: https://github.com/apache/beam/pull/13843#discussion_r567140291
##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -63,23 +63,33 @@ def _run_test(self, func, *args, distributed=True,
expect_error=False):
"Expected an error:\n{expected}\nbut successfully "
f"returned:\n{actual}")
- if not expect_error:
- if hasattr(expected, 'equals'):
+ if expect_error:
+ self.assertIsInstance(expected, Exception)
+ self.assertIsInstance(actual, type(expected))
+ self.assertEqual(str(actual), str(expected))
+ else:
+ if isinstance(expected, pd.core.generic.NDFrame):
if distributed:
- cmp = lambda df: expected.sort_index().equals(df.sort_index())
+ expected = expected.sort_index()
+ actual = actual.sort_index()
+
+ if isinstance(expected, pd.Series):
+ pd.testing.assert_series_equal(expected, actual)
+ elif isinstance(expected, pd.DataFrame):
+ pd.testing.assert_frame_equal(expected, actual)
Review comment:
Note this PR also switches to using `pd.testing.assert_*_equal`, I
needed it here because it handles floating point precision for us.
This works without issue, except for a minor issue with the DateIndex in
test_loc, we don't preserve the freq attribute, which assert_frame_equal checks.
----------------------------------------------------------------
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: 544549)
Time Spent: 1h (was: 50m)
> Implement GroupBy.apply
> -----------------------
>
> Key: BEAM-11628
> URL: https://issues.apache.org/jira/browse/BEAM-11628
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Brian Hulette
> Priority: P2
> Labels: dataframe-api
> Time Spent: 1h
> Remaining Estimate: 0h
>
> https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.apply.html
> We can partition by key and then apply func on each key. It should be
> possible to create a proxy by passing a proxy to the function.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)