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


Groups > comp.lang.python > #75397

Re: speed up pandas calculation

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 2014-07-30 21:28 -0500
Subject Re: speed up pandas calculation
From Skip Montanaro <skip.montanaro@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12452.1406773743.18130.python-list@python.org> (permalink)

Show all headers | 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