格式:series[(判断条件1)&(判断条件2)|(判断条件3)] 只要返回值是bool型就可用做筛选:series[bool]
课上练习:
求筛选以'张'开头的序列
s=Series(["张3","张4","王5","赵6"],index=['a','b','c','d'])
In:s.str.startswith("张")
Out:
a 张3 b 张4 dtype: object
#startswith中间有个s,startswith中间有个s,startswith中间有个s