Kaggle / Kaggle/learntools

Error in solution in Pandas tutorial

Open
#247 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
514
Forks
274
PR merge metrics
No merged PRs in 30d

Description

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

```
TypeError Traceback (most recent call last)
in
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.