对excel中transform的使用,直接上代码啦

#coding=utf-8
"""
@author=wanggang
date:March,4,2020
"""
import pandas as pd
ws=pd.read_excel('tp_2017conference.xlsx')
wt=ws.title
wscore=ws.score
wlevel=ws.level
ws['max']=ws.groupby('title')['score'].transform('max')#求最大值
ws['min']=ws.groupby('title')['score'].transform('min')#求最小值
# for i in ws['max']:
#     print(i)
for j in ws['min']:
    print(j)

输出最小值

发布了218 篇原创文章 · 获赞 110 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/zhuiyunzhugang/article/details/104649458