标签:t_sql core .data end axis 算法 div pandas panda
select_sql = ‘select * from recommend_key‘ datas = pd.read_sql(select_sql, connection) # <pandas.core.frame.DataFrame‘> temp = datas.iloc[:, 2:] # 取出所有数据的 除了前两个字段 tp = temp.sum(axis=0) # 所有字段纵向相加 top_sorts = tp.sort_values(ascending=False) # 降序排序 top3 = top_sorts.index[:4] top_recommends = top3.values.tolist()
标签:t_sql core .data end axis 算法 div pandas panda
原文地址:https://www.cnblogs.com/tangpg/p/9815742.html