dataframe2

===><一定要看官方文档,看了官方文档才明白是怎么回事

DataFrameGroupBy.agg(arg改为func好对应图片*args**kwargs)[source]

Aggregate using one or more operations over the specified axis.

Parameters:

func : function, string, dictionary, or list of string/functions

Function to use for aggregating the data. If a function, must either work when passed a DataFrame or when passed to DataFrame.apply. For a DataFrame, can pass a dict, if the keys are DataFrame column names.

Accepted combinations are:

  • string function name.
  • function.
  • list of functions.
  • dict of column names -> functions (or list of functions).

*args

Positional arguments to pass to func.--》为func服务的,单独没意义

**kwargs

Keyword arguments to pass to func.---》为func服务的,单独没意义

 

===>

  

这里的没有属性quantity,指的是quantity不是像‘sum’,‘max’,等函数式名称属性

对比下面两幅图===》传函数对象时,加可变参数有意义,传字符串时,不能加可变参数