pandas.DataFrame.filter
DataFrame.filter(items=None, like=None, regex=None, axis=None)
參數(shù)列表 items=None, like=None, regex=None, axis=None
>>>df
one two three
mouse 1 2 3
rabbit 4 5 6
items對(duì)列進(jìn)行篩選廷粒,包含'one', 'three'列選取
>>>df.filter(items=['one', 'three'])
one three
mouse 1 3
rabbit 4 6
filter 對(duì)正則表達(dá)式進(jìn)行匹配
>>>df.filter(regex='e$', axis=1)
one three
mouse 1 3
rabbit 4 6
like 對(duì)行進(jìn)行篩選待牵,行名中有bbi選擇
df.filter(like='bbi', axis=0)
one two three
rabbit 4 5 6