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
原文地址:https://www.cnblogs.com/ppqchina/p/6231637.html