File tree 1 file changed +3
-9
lines changed
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -277,19 +277,13 @@ def _wrap_result(
277
277
# required when expand=True is explicitly specified
278
278
# not needed when inferred
279
279
280
- def cons_row (x ):
281
- if is_list_like (x ):
282
- return x
283
- else :
284
- return [x ]
280
+ mask = isna (result )
281
+ result = [[x ] if mask [i ] else x for i , x in enumerate (result )]
285
282
286
- result = [cons_row (x ) for x in result ]
287
283
if result and not self ._is_string :
288
284
# propagate nan values to match longest sequence (GH 18450)
289
285
max_len = max (len (x ) for x in result )
290
- result = [
291
- x * max_len if len (x ) == 0 or x [0 ] is np .nan else x for x in result
292
- ]
286
+ result = [x * max_len if mask [i ] else x for i , x in enumerate (result )]
293
287
294
288
if not isinstance (expand , bool ):
295
289
raise ValueError ("expand must be True or False" )
You can’t perform that action at this time.
0 commit comments