Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in solution in Pandas tutorial #247

Open
dimka11 opened this issue Feb 11, 2020 · 0 comments
Open

Error in solution in Pandas tutorial #247

dimka11 opened this issue Feb 11, 2020 · 0 comments

Comments

@dimka11
Copy link

dimka11 commented Feb 11, 2020

price_extremes = reviews.groupby('variety').price.agg([min, max])

TypeError                                 Traceback (most recent call last)
<ipython-input-81-1ee08b4f09ca> in <module>
      1 #q3.hint()
      2 q3.solution()
----> 3 price_extremes = reviews.groupby('variety').price.agg([min, max])

/opt/conda/lib/python3.6/site-packages/pandas/core/groupby/generic.py in aggregate(self, func_or_funcs, *args, **kwargs)
    849             # but not the class list / tuple itself.
    850             func_or_funcs = _maybe_mangle_lambdas(func_or_funcs)
--> 851             ret = self._aggregate_multiple_funcs(func_or_funcs, (_level or 0) + 1)
    852             if relabeling:
    853                 ret.columns = columns

/opt/conda/lib/python3.6/site-packages/pandas/core/groupby/generic.py in _aggregate_multiple_funcs(self, arg, _level)
    916         for name, func in arg:
    917             obj = self
--> 918             if name in results:
    919                 raise SpecificationError(
    920                     "Function names must be unique, found multiple named "

/opt/conda/lib/python3.6/site-packages/pandas/core/generic.py in __hash__(self)
   1884         raise TypeError(
   1885             "{0!r} objects are mutable, thus they cannot be"
-> 1886             " hashed".format(self.__class__.__name__)
   1887         )
   1888 

TypeError: 'Series' objects are mutable, thus they cannot be hashed

Exercise: Grouping and Sorting - point 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant