Skip to content

Difference in groupby behavior between Pandas 0.13.1 and 0.15.2 #9560

Closed
@dakoner

Description

@dakoner

Hi, I am seeing a difference in behavior on this groupby between Pandas 0.13.1 and 0.15.2. Specifically, it's like 0.15.2 is doing a cross join while 0.13.1 isn't.

print pandas.DataFrame([
  {'a': 1, 'b': 2, 'c': 3},
  {'a': 4, 'b': 5, 'c': 6}, ]).set_index(
    list('ab')).groupby(level=list('ab')).mean()

0.13.1 produces:

     c
a b   
1 2  3
4 5  6
[2 rows x 1 columns]

while 0.15.2 produces

      c
a b    
1 2   3
  5 NaN
4 2 NaN
  5   6

basically, the same matrix, but with extra cross NaN entries.

We're wondering if this behavior is intentional, or a bug. It wasn't entirely clear from the set of release notes that the groupby behavior changed so much.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions