python:FutureWarning:usingadictonaSeriesforaggregationisdeprecatedandwillberemovedinafutureversion报错解决
方法/步骤
1、python机器学习实践指南,原书蜣贺鱿柢代码:df.groupby('class')['petalwidth']\.agg({'de造婷用痃lta':lambdax:x.max()-x.min(),'max':np.max,'min':np.min})
2、运酚祯馄嫱行后报错:FutureWarning:usingadictonaSeriesforaggregationisdeprecatedandwillberemove颊俄岿髭dinafutureversion'max':np.max,'min':np.min})
3、修改如下:defdelta(group):returnmax(group)-min(group)df.groupby('class')['petalwidth'].agg([delta])
4、运行结果:如下图
5、详情请参见:http://pandas.pydata.org/pandas-docs/stable/.打不开请越狱
6、有用的话请给我投票吧,谢谢!!!