using a dict on a Series for aggregation is deprecated and will be removed in a future version

python的pandas中,在统计聚合的时候,版本问题,提示不支持字典格式了。

比如,下面代码这样改就可以了。

    words_stat = words_df.groupby(by=['segment'])['segment'].agg({"计数": numpy.size})  
    上面代码改成下面代码就可以了。应该是版本问题。  
    word_stat = word_df.groupby(by=['segment'])['segment'].agg(np.size)  
    word_stat = word_stat.to_frame()  
    word_stat.columns = ['计数']  

 

你可能感兴趣的:(using a dict on a Series for aggregation is deprecated and will be removed in a future version)