pandas apply 草稿,等待合集

def func(x1,before,after,a,b):#x1代表一整行数据,before=line0,a=t(11) print(x1[before]) print(a) print(b) return a*b i=list(range(0,10)) i1=list(range(10,20)) i2=list(range(20,30)) ser=pd.DataFrame([i,i1,i2]).T#构造dataframe ser.columns=["line0","line1","line2"]#指定行的名字 t=11#apply的参数 r={"k":123}#apply的参数 ser["qe"]=ser.apply(func,axis=1, args = (‘line0‘,‘line2‘),**{‘a‘:t,‘b‘:‘1t‘}) print(ser)

pandas apply 草稿,等待合集

上一篇:Spring和MyBatis整合


下一篇:LeetCode 448 Find All Numbers Disappeared in an Array 解题报告