Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'toss': 0.09; 'cc:addr :python-list': 0.11; '(now': 0.16; 'columns': 0.16; 'effect.': 0.16; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'could': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'issue': 0.38; 'complete': 0.62; 'real': 0.63; 'more': 0.64; 'responses': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rOOSLZ3kaNJCl45hcNHNwIRqop52fOPRLvLFeQcmmuk=; b=AbUPL1ZZMUY+1sh4/+g2bA69YiQmds/+wnk4tkv0qd3mGldxUDNqPkVCyRXSopT4PQ VOwxO/IDLqr55TS7EageHNmOVqir/JG0Vu9qnsSJGVm3CpEKEOVgCkWFcFXNsFVjKEHo 4EOAJTKQavpMMcjX3+gH56z+Xal517v0CXQt1QhOORIg6wUMWUPucafk0EZdJ7fOgYlN osOP6QWbXv/wAxbHl1evm/ZWpxbFjWegpyVs1xRLb4qRwxNRADPIUm+BNIDt9AO9HuG0 Xf1sQZrmpVYDvysS/lohUW9gUehPzJEpH1r8U46ZFEQ1qhZCsOligtS4ASjJXSPI14Bk faHQ== MIME-Version: 1.0 X-Received: by 10.42.82.6 with SMTP id b6mr10417051icl.51.1406773490565; Wed, 30 Jul 2014 19:24:50 -0700 (PDT) In-Reply-To: References: Date: Wed, 30 Jul 2014 21:24:50 -0500 Subject: Re: speed up pandas calculation From: Skip Montanaro To: Vincent Davis Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406773498 news.xs4all.nl 2927 [2001:888:2000:d::a6]:55860 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75396 (Now that I'm on a real keyboard, more complete responses are a bit easier.) Regarding the issue of missing columns from keep_col, you could create sets of what you have and what you want, and toss the rest: toss_these = list(set(df.columns) - set(keep_col)) del df[toss_these] Or something to that effect. Skip