Good morning –
Got a question for a mlab module guru.
After some experimentation (and judicious peeking at the
source code), I think I’ve got the hang of writing custom functions to
pass into these modules – basically, anything that accepts a list of
values sliced from a single column on the structured array and returns a single
list seems to work well. In functional programming terms, rec_summarize appears
similar to “map”, rec_groupby appears similar to
Now – what if I want to derive a calculation from
multiple statistics in the original dataset – eg. create a new column on
the array which is derived from 2 (or up to n) other fields in a custom
function which I pass into the process?
For example, conditional counts/summaries (count
transactions and sum the sales on all orders that weighed > 5K lbs).
Is there a way to do this within numpy or mlab without going
all the way out to python and creating a list comprehension?