python pandas根据首字母选行

ret2.loc[ret2['INNERCODE'].map(lambda x:x[0]=='6' or x[0]=='3' or x[0]=='0' ),:]

和matlab不一样的风格 - -

直接用filter更方便
ret2 = filter(lambda x:x[0]=='6' or x[0]=='3' and x[0]=='0',ret) 用好map , filter, reduce pandas,numpy,list要分清楚
pandas有.map
.filter没有iter list直接用map,filter,类似matlab
上一篇:洛谷P2744 [USACO5.3]量取牛奶Milk Measuring


下一篇:luogu P2744 [USACO5.3]量取牛奶Milk Measuring