Skip to content

Commit 20f2ccc

Browse files
committed
API: Sum / Prod of empty / all-NA [resample]
1 parent e96e386 commit 20f2ccc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/tests/test_resample.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -3385,7 +3385,13 @@ def test_aggregate_with_nat(self):
33853385
for func in ['min', 'max', 'sum', 'prod']:
33863386
normal_result = getattr(normal_grouped, func)()
33873387
dt_result = getattr(dt_grouped, func)()
3388-
pad = DataFrame([[np.nan, np.nan, np.nan, np.nan]], index=[3],
3388+
if func == 'sum':
3389+
fill_value = 0
3390+
elif func == 'prod':
3391+
fill_value = 1
3392+
else:
3393+
fill_value = np.nan
3394+
pad = DataFrame([[fill_value] * 4], index=[3],
33893395
columns=['A', 'B', 'C', 'D'])
33903396
expected = normal_result.append(pad)
33913397
expected = expected.sort_index()

0 commit comments

Comments
 (0)