We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Against master:
In [8]: pandas.DataFrame({'A':["A","B","C", "A"], 'B':list("ABCD")}).groupby("A").B.idxmax() --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-8-6aa5f42cc358> in <module>() ----> 1 pandas.DataFrame({'A':["A","B","C", "A"], 'B':list("ABCD")}).groupby("A").B.idxmax() /home/apprun/gitrepos/pandas/pandas/core/groupby.py in wrapper(*args, **kwargs) 341 return self.apply(curried_with_axis) 342 except Exception: --> 343 return self.apply(curried) 344 345 return wrapper /home/apprun/gitrepos/pandas/pandas/core/groupby.py in apply(self, func, *args, **kwargs) 422 return func(g, *args, **kwargs) 423 --> 424 return self._python_apply_general(f) 425 426 def _python_apply_general(self, f): /home/apprun/gitrepos/pandas/pandas/core/groupby.py in _python_apply_general(self, f) 425 426 def _python_apply_general(self, f): --> 427 keys, values, mutated = self.grouper.apply(f, self.obj, self.axis) 428 429 return self._wrap_applied_output(keys, values, /home/apprun/gitrepos/pandas/pandas/core/groupby.py in apply(self, f, data, axis) 881 # group might be modified 882 group_axes = _get_axes(group) --> 883 res = f(group) 884 if not _is_indexed_like(res, group_axes): 885 mutated = True /home/apprun/gitrepos/pandas/pandas/core/groupby.py in f(g) 420 @wraps(func) 421 def f(g): --> 422 return func(g, *args, **kwargs) 423 424 return self._python_apply_general(f) /home/apprun/gitrepos/pandas/pandas/core/groupby.py in curried(x) 327 328 def curried(x): --> 329 return f(x, *args, **kwargs) 330 331 # preserve the name so we can detect it when calling plot methods, /home/apprun/gitrepos/pandas/pandas/core/series.py in idxmax(self, axis, out, skipna) 1284 DataFrame.idxmax 1285 """ -> 1286 i = nanops.nanargmax(_values_from_object(self), skipna=skipna) 1287 if i == -1: 1288 return pa.NA /home/apprun/gitrepos/pandas/pandas/core/nanops.py in nanargmax(values, axis, skipna) 387 """ 388 values, mask, dtype = _get_values(values, skipna, fill_value_typ='-inf', --> 389 isfinite=True) 390 result = values.argmax(axis) 391 result = _maybe_arg_null_out(result, axis, mask, skipna) /home/apprun/gitrepos/pandas/pandas/core/nanops.py in _get_values(values, skipna, fill_value, fill_value_typ, isfinite, copy) 139 values = _values_from_object(values) 140 if isfinite: --> 141 mask = _isfinite(values) 142 else: 143 mask = isnull(values) /home/apprun/gitrepos/pandas/pandas/core/nanops.py in _isfinite(values) 173 return isnull(values) 174 elif isinstance(values.dtype, object): --> 175 return -np.isfinite(values.astype('float64')) 176 177 return -np.isfinite(values) ValueError: could not convert string to float: D
but this works:
In [9]: pandas.DataFrame({'A':["A","B","C", "A"], 'B':list("ABCD")}).groupby("A").B.max() Out[9]: A A D B B C C Name: B, dtype: object
The text was updated successfully, but these errors were encountered:
This seems related: #4279 although that issue seems to indicate a numpy problem which this does not seem to be,
Sorry, something went wrong.
its the same issue; it could be made to work
closing this and I'll put a reference
idxmax()
No branches or pull requests
Against master:
but this works:
The text was updated successfully, but these errors were encountered: