Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75397

Re: speed up pandas calculation

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'chunks': 0.16; 'col': 0.16; 'loops': 0.16; 'numpy': 0.16; 'selections': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'skip': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message- id:@mail.gmail.com': 0.30; 'closer': 0.31; 'class': 0.32; 'languages': 0.32; 'another': 0.32; 'operate': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'unit': 0.37; 'list': 0.37; 'pm,': 0.38; 'expression': 0.60; '30,': 0.65; 'jul': 0.74; 'attention': 0.75
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=isbG4of5gssVHFHmhTykd/uS/AttvSgv+kqgmCrzIFQ=; b=ll2Ycxp1JFghLVhLBnb7FECZGK//ZLsnqq6mIfnFkzkEWRq4zxcy+yp+vZQ2kw6qol RH/R79An+uDjczQLUgdTnpNE9gye35sOZLQBbgPRbNLpm0xWeE9izB8DQcDCdTwog8mU aNeIZR7lKs6HLy8Pf3Oz3vnn3ev9MR9rrG/v1BdFy0VLuzS7PcOlAFBTHAQTM1VlSf1Y q861rY1TJj0B1qcBnMIZR2gNbGOEQOVjBpJ/zXvgd8nszhw/Wd95OOijwMnnokDDoZsJ EYjw6UnUNPkawvOt/yyN7gG/bKurg+glgN/YzxR7PviWtZpk6sbJ9VByoCrFdAWh/MBM wvlg==
MIME-Version 1.0
X-Received by 10.42.208.70 with SMTP id gb6mr10270716icb.89.1406773739957; Wed, 30 Jul 2014 19:28:59 -0700 (PDT)
In-Reply-To <CALvWhxtuAnaW4WrenCZw-ASZqkUszfv+p8V9JeZNBE=2VtuZcg@mail.gmail.com>
References <CALyJZZXMmSk8L7+P7erQSp2W4EpkbxiXmJkY-+5svfK5C3Z0kw@mail.gmail.com> <CANc-5UzCLT8ZPF2PCDMQyOqr0gqrDjFGnsRAoFBfGVmCh5-0jg@mail.gmail.com> <CALyJZZWtCwRqL_QZJEe415o1_L_g6A4ZhrFJe6y3z1_jysfSxA@mail.gmail.com> <CALyJZZUQiw7W-EbOqDYF0wfuBJ5pTexP00FEndsOxNy5+MQrnA@mail.gmail.com> <CALvWhxtuAnaW4WrenCZw-ASZqkUszfv+p8V9JeZNBE=2VtuZcg@mail.gmail.com>
Date Wed, 30 Jul 2014 21:28:59 -0500
Subject Re: speed up pandas calculation
From Skip Montanaro <skip.montanaro@gmail.com>
To Chris Kaynor <ckaynor@zindagigames.com>
Content-Type text/plain; charset=UTF-8
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12452.1406773743.18130.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406773743 news.xs4all.nl 2908 [2001:888:2000:d::a6]:58510
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75397

Show key headers only | View raw


On Wed, Jul 30, 2014 at 8:11 PM, Chris Kaynor <ckaynor@zindagigames.com> wrote:
> Another way to write this, using a list expression (untested):
> new_df = [col for col in df if col.value in keep_col]

As I am learning (often painfully) with pandas and JavaScript+(d3 or
jQuery), loops are the enemy. You want to operate on large chunks of
data simultaneously. In pandas, those chunks are thinly disguised
numpy arrays. In JS+(ds or jQuery), those chunks are selections from
the DOM.

I should have paid closer attention to the APL unit of my programming
languages survey class in college.

Skip

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: speed up pandas calculation Skip Montanaro <skip.montanaro@gmail.com> - 2014-07-30 21:28 -0500
  Re: speed up pandas calculation Rustom Mody <rustompmody@gmail.com> - 2014-07-30 19:55 -0700

csiph-web