DOC: DataFrame.agg
and Series.agg
documentation is unclear on which function we can use
#49528
Open
1 task done
Uh oh!
There was an error while loading. Please reload this page.
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.agg.html
https://pandas.pydata.org/docs/reference/api/pandas.Series.agg.html
Documentation problem
During discussion for issue #49352 we found that the documentation of the
agg
function for both DataFrame and Series is unclear onSuggested fix for documentation
For
DataFrame.agg
, it must be explained that:The passed function must accept either a Series and return a scalar, or a DataFrame and returns a Series. If the axis is 0 and the function accept a Series, the passed Series will be a column, otherwise, it will be a row. If function names are passed, the called function will be the first function found according to the MRO from a DataFrame object (that is, the result of getattr(df, 'func_name')). For instance, passing
mean
will match DataFrame.mean.For
Series.agg
, it must be explained that:The passed function must accept either a Series and return a scalar. If function names are passed, the called function will be the first function found according to the MRO from a Series object (that is, the result of getattr(s, 'func_name')).
The text was updated successfully, but these errors were encountered: