Skip to content

groupby().last() drops columns #1809

Closed
Closed
@gtakacs

Description

@gtakacs

DataFrame.groupby().last() gives incorrect result in the following case (pandas version: 0.8.1):

df1 = DataFrame({"A": [1, 1], "B": [1, 1], "C": ["x", "y"]})
print df1.groupby("A").last()
#    B
# A   
#1  1

The integer column B is handled correctly, but the string column C is dropped.
The result is correct if column B is not present:

df2 = DataFrame({"A": [1, 1], "C": ["x", "y"]})
print df2.groupby("A").last()
#    C
# A   
#1  y

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions