列所以我有一個Python 2.7熊貓數據幀包含大量列的一樣:Python的大熊貓過濾器由多個字符串
['SiteName', 'SSP', 'PlatformClientCost', 'rawmachinecost', 'rawmachineprice', 'ClientBid' +... + 20 more]
而且我想排除所有列中包含的任何單詞「平臺」或'客戶'以下是我的嘗試:
col = [c for c in dataframe.columns if c.lower() not in ('platform','client') ]
print col
['SiteName', 'SSP', 'IONumber', 'userkey', 'Imps', 'PlatformClientCost', 'rawplatformcost', 'rawbidprice', 'PlatformClientBid', 'RawBidCPM', 'ClientBidCPM', 'CostCPM', 'ClientCostCPM', 'BidRatio']
我在網上找不到任何相關的解決方案,所以任何幫助將超級感激!
感謝, 威爾
太棒了!謝謝! –