如何把code中的688开头,300开头的那几行删除掉?目前code应该是作为行索引。
如果是688,300开头的就删除,其他的保留。
df['tmp']=df.index
df.drop(df[(df['tmp'].str.find('688')==0) | (df['tmp'].str.find('300')==0)].index,inplace=True)
del df['tmp']
df[~df['code'].str.contains('688')]
df[~df['code'].str.contains('300')]
找某某开头的字符串用str.startswith()方法