@@ -1223,6 +1223,8 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
1223
1223
if isinstance (first_not_none , DataFrame ):
1224
1224
return self ._concat_objects (keys , values , not_indexed_same = not_indexed_same )
1225
1225
1226
+ key_index = self .grouper .result_index if self .as_index else None
1227
+
1226
1228
if isinstance (first_not_none , NDFrame ):
1227
1229
1228
1230
# this is to silence a DeprecationWarning
@@ -1236,11 +1238,7 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
1236
1238
backup = first_not_none ._constructor (** kwargs )
1237
1239
1238
1240
values = [x if (x is not None ) else backup for x in values ]
1239
-
1240
- key_index = self .grouper .result_index if self .as_index else None
1241
- v = values [0 ]
1242
-
1243
- if not isinstance (v , (np .ndarray , Index , Series )):
1241
+ else :
1244
1242
# values are not series or array-like but scalars
1245
1243
# self._selection_name not passed through to Series as the
1246
1244
# result should not take the name of original selection
@@ -1252,6 +1250,8 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
1252
1250
self ._insert_inaxis_grouper_inplace (result )
1253
1251
return result
1254
1252
1253
+ v = values [0 ]
1254
+
1255
1255
if not isinstance (v , ABCSeries ):
1256
1256
# GH1738: values is list of arrays of unequal lengths
1257
1257
# TODO: sure this is right? we used to do this
0 commit comments