a['Names'].str.contains('Mel') 将返回大小为布尔值的指标向量 len(BabyDataSet)
因此,您可以使用
mel_count=a['Names'].str.contains('Mel').sum()if mel_count>0: print ("There are {m} Mels".format(m=mel_count))或者
any(),如果您不在乎有多少条记录与您的查询匹配
if a['Names'].str.contains('Mel').any(): print ("Mel is there")


