Skip to content

Commit e1583c1

Browse files
committed
BUG: don't attach nonsense 'result' name to groupby results without obvious name, close #995
1 parent c03c1b9 commit e1583c1

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

RELEASE.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pandas 0.7.3
3232
- Add group_keys argument to groupby to not add group names to MultiIndex in
3333
result of apply (GH #938)
3434
- scatter_matrix method in pandas/tools/plotting.py (PR #935)
35+
- Add ``kurt`` methods to Series and DataFrame (PR #964)
3536

3637
**API Changes**
3738

@@ -40,6 +41,8 @@ pandas 0.7.3
4041

4142
**Bug fixes**
4243

44+
- Don't attach nonsense 'result' name to groupby results (GH #995)
45+
4346
pandas 0.7.2
4447
============
4548

pandas/core/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def indices(self):
131131
@property
132132
def name(self):
133133
if self._column is None:
134-
return 'result'
134+
return None # 'result'
135135
else:
136136
return self._column
137137

pandas/tests/test_groupby.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,14 @@ def test_skip_group_keys(self):
16061606
expected = concat(pieces)
16071607
assert_series_equal(result, expected)
16081608

1609+
def test_no_nonsense_name(self):
1610+
# GH #995
1611+
s = self.frame['C'].copy()
1612+
s.name = None
1613+
1614+
result = s.groupby(self.frame['A']).agg(np.sum)
1615+
self.assert_(result.name is None)
1616+
16091617
def _check_groupby(df, result, keys, field, f=lambda x: x.sum()):
16101618
tups = map(tuple, df[keys].values)
16111619
tups = com._asarray_tuplesafe(tups)

0 commit comments

Comments
 (0)