Skip to content

DOC: Dataframe.apply does not always return a Series when reduce=True #15628

Closed
@NelsonAndrew

Description

@NelsonAndrew

Code Sample, a copy-pastable example if possible

pd.DataFrame({'col_1':['val_1','val_2','val_3']}).apply(lambda row: [1], axis=1, reduce=True)

Problem description

Per the documentation, calling Dataframe.apply w/ reduce=True should always produce a Series. However, if the applied function returns list values Dataframe.apply returns a Dataframe, not a Series.

Expected Output

When called with reduce=True, I expect Dataframe.apply to produce a Series where each element is a list, not a Dataframe.

Output of pd.show_versions()

0.18.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApplyApply, Aggregate, Transform, MapDocsReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions