Skip to content

REGR: Series.groupby([]) raises #27190

Closed
@TomAugspurger

Description

@TomAugspurger

Pandas 0.24.2

In [14]: s = pd.Series([])

In [15]: s.groupby([])
Out[15]: <pandas.core.groupby.groupby.SeriesGroupBy object at 0x11f4d8748>

master

In [8]: s = pd.Series([])

In [9]: s.groupby([])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-cd9ba1ec9bdd> in <module>
----> 1 s.groupby([])

~/sandbox/pandas/pandas/core/generic.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, **kwargs)
   7496         return groupby(self, by=by, axis=axis, level=level, as_index=as_index,
   7497                        sort=sort, group_keys=group_keys, squeeze=squeeze,
-> 7498                        observed=observed, **kwargs)
   7499
   7500     def asfreq(self, freq, method=None, how=None, normalize=False,

~/sandbox/pandas/pandas/core/groupby/groupby.py in groupby(obj, by, **kwds)
   2402         raise TypeError('invalid type: {}'.format(obj))
   2403
-> 2404     return klass(obj, by, **kwds)

~/sandbox/pandas/pandas/core/groupby/groupby.py in __init__(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze, observed, **kwargs)
    362                                                     sort=sort,
    363                                                     observed=observed,
--> 364                                                     mutated=self.mutated)
    365
    366         self.obj = obj

~/sandbox/pandas/pandas/core/groupby/grouper.py in _get_grouper(obj, key, axis, level, sort, observed, mutated, validate)
    608
    609     if len(groupings) == 0:
--> 610         raise ValueError('No group keys passed!')
    611
    612     # create the internals grouper

ValueError: No group keys passed!

I think this should work. If not, we'll want to deprecate it properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GroupbyRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions