@@ -1190,14 +1190,6 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
1190
1190
1191
1191
key_index = self .grouper .result_index if self .as_index else None
1192
1192
1193
- if isinstance (first_not_none , Series ):
1194
- # this is to silence a DeprecationWarning
1195
- # TODO: Remove when default dtype of empty Series is object
1196
- kwargs = first_not_none ._construct_axes_dict ()
1197
- backup = create_series_with_explicit_dtype (dtype_if_empty = object , ** kwargs )
1198
-
1199
- values = [x if (x is not None ) else backup for x in values ]
1200
-
1201
1193
if isinstance (first_not_none , (np .ndarray , Index )):
1202
1194
# GH#1738: values is list of arrays of unequal lengths
1203
1195
# fall through to the outer else clause
@@ -1217,8 +1209,13 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
1217
1209
result = DataFrame (values , index = key_index , columns = [self ._selection ])
1218
1210
self ._insert_inaxis_grouper_inplace (result )
1219
1211
return result
1220
-
1221
1212
else :
1213
+ # this is to silence a DeprecationWarning
1214
+ # TODO: Remove when default dtype of empty Series is object
1215
+ kwargs = first_not_none ._construct_axes_dict ()
1216
+ backup = create_series_with_explicit_dtype (dtype_if_empty = object , ** kwargs )
1217
+ values = [x if (x is not None ) else backup for x in values ]
1218
+
1222
1219
all_indexed_same = all_indexes_same (x .index for x in values )
1223
1220
1224
1221
# GH3596
0 commit comments