import pandas as pdimport numpy as nparray=np.random.random((2,4))df=pd.Dataframe(array, columns=('Test1', 'toto', 'test2', 'riri'))print df Test1 toto test2 riri0 0.923249 0.572528 0.845464 0.1448911 0.020438 0.332540 0.144455 0.741412cols = [c for c in df.columns if c.lower()[:4] != 'test']df=df[cols]print df toto riri0 0.572528 0.1448911 0.332540 0.741412
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)