speed up pandas calculation

Skip Montanaro skip.montanaro at gmail.com
Thu Jul 31 04:28:59 CEST 2014

On Wed, Jul 30, 2014 at 8:11 PM, Chris Kaynor <ckaynor at 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.


More information about the Python-list mailing list