I need a rolling_product function, or an expanding_product function.
There are various pandas
rolling_XXXX
and expanding_XXXX
functions, but I was surprised to discover the absence of an expanding_product()
function.
To get things working I've been using this rather slow alternative
pd.expanding_apply(temp_col, lambda x : x.prod())
My arrays often have 32,000 elements so this is proving to be a bit of a bottleneck. I was tempted to try log()
, cumsum()
, and exp()
, but I thought I should ask on here since there might be a much better solution.