@@ -480,7 +480,7 @@ def _transform_fast(self, func, func_nm):
480
480
out = self ._try_cast (out , self .obj )
481
481
return Series (out , index = self .obj .index , name = self .obj .name )
482
482
483
- def filter (self , func , dropna = True , * args , ** kwargs ): # noqa
483
+ def filter (self , func , dropna = True , * args , ** kwargs ):
484
484
"""
485
485
Return a copy of a Series excluding elements from groups that
486
486
do not satisfy the boolean criterion specified by func.
@@ -1228,7 +1228,7 @@ def first_not_none(values):
1228
1228
return self ._concat_objects (keys , values , not_indexed_same = True )
1229
1229
1230
1230
try :
1231
- if self .axis == 0 :
1231
+ if self .axis == 0 and isinstance ( v , ABCSeries ) :
1232
1232
# GH6124 if the list of Series have a consistent name,
1233
1233
# then propagate that name to the result.
1234
1234
index = v .index .copy ()
@@ -1264,15 +1264,24 @@ def first_not_none(values):
1264
1264
axis = self .axis ,
1265
1265
).unstack ()
1266
1266
result .columns = index
1267
- else :
1267
+ elif isinstance ( v , ABCSeries ) :
1268
1268
stacked_values = np .vstack ([np .asarray (v ) for v in values ])
1269
1269
result = DataFrame (
1270
1270
stacked_values .T , index = v .index , columns = key_index
1271
1271
)
1272
+ else :
1273
+ # GH#1738: values is list of arrays of unequal lengths
1274
+ # fall through to the outer else clause
1275
+ # TODO: sure this is right? we used to do this
1276
+ # after raising AttributeError above
1277
+ return Series (
1278
+ values , index = key_index , name = self ._selection_name
1279
+ )
1272
1280
1273
- except (ValueError , AttributeError ):
1281
+ except ValueError :
1282
+ # TODO: not reached in tests; is this still needed?
1274
1283
# GH1738: values is list of arrays of unequal lengths fall
1275
- # through to the outer else caluse
1284
+ # through to the outer else clause
1276
1285
return Series (values , index = key_index , name = self ._selection_name )
1277
1286
1278
1287
# if we have date/time like in the original, then coerce dates
0 commit comments