Skip to content

Commit 61f432f

Browse files
author
Daniel Saxton
committed
Move condition
1 parent aa4b33b commit 61f432f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/core/apply.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,12 @@ def apply_empty_result(self):
212212
except Exception:
213213
pass
214214

215-
if reduce and len(self.agg_axis):
216-
r = self.f(Series([]), *self.args, **self.kwds)
215+
if reduce:
216+
if len(self.agg_axis):
217+
r = self.f(Series([]), *self.args, **self.kwds)
218+
else:
219+
r = np.nan
220+
217221
return self.obj._constructor_sliced(r, index=self.agg_axis)
218222
else:
219223
return self.obj.copy()

0 commit comments

Comments
 (0)