Live data from Hacker News

Ask HN: Where can I find examples and resources on how to vectorize in Python?

news.ycombinator.com

1–3 of 3 posts

Ask HN: Where can I find examples and resources on how to vectorize in Python?

#1
Mainly the lambda like or .apply() like code styles? Where can I find examples and resources on how to vectorize code in Python (for fast Pandas and Numpy execution), for e.g. vectorize code like this: def some_function(): return group_series.apply(lambda x: x.astype(some_type).rolling(some_number).sum().shift(some_number))

or even something like this: def some_function(): return some_grouped_data_series.apply( lambda x: x.some_function(param1=value1, param2=value2).mean().shift(some_number) )

Mainly the lambda like or .apply() like code styles

Any suggestions I should try to vectorize the above, I tried a few things but it complains or I get undesired results. My python performance shares can be found here: https://github.com/neomatrix369/awesome-ai-ml-dl/blob/master/Programming-in-Python.md#performance, please feel free to share yours via a PR.