Skip to content

Commit 9963b2f

Browse files
committed
review comments
1 parent 239f3c0 commit 9963b2f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pandas/core/groupby/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _cython_agg_blocks(self, how, alt=None, numeric_only=True,
160160
s = groupby(obj, self.grouper)
161161
try:
162162
result = s.aggregate(lambda x: alt(x, axis=self.axis))
163-
except Exception:
163+
except TypeError:
164164
# we may have an exception in trying to aggregate
165165
# continue and exclude the block
166166
pass

pandas/tests/sparse/test_pivot.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ def test_pivot_table(self):
4242
values='E', aggfunc='mean')
4343
tm.assert_frame_equal(res_sparse, res_dense)
4444

45-
# ToDo: sum doesn't handle nan properly
46-
# res_sparse = pd.pivot_table(self.sparse, index='A', columns='B',
47-
# values='E', aggfunc='sum')
48-
# res_dense = pd.pivot_table(self.dense, index='A', columns='B',
49-
# values='E', aggfunc='sum')
50-
# tm.assert_frame_equal(res_sparse, res_dense)
45+
def test_pivot_table_with_nans(self):
46+
res_sparse = pd.pivot_table(self.sparse, index='A', columns='B',
47+
values='E', aggfunc='sum')
48+
res_dense = pd.pivot_table(self.dense, index='A', columns='B',
49+
values='E', aggfunc='sum')
50+
tm.assert_frame_equal(res_sparse, res_dense)
5151

5252
@pytest.mark.xfail(not _np_version_under1p17,
5353
reason="failing occasionally on numpy > 1.17",

0 commit comments

Comments
 (0)