You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have a vectorized version of sq.sample. I often find myself having data frames or series that contain distributions, and when I want to expand those to medians and percentiles, I have to use apply which is slow and a bit verbose. Nicer would be to be able to sample the entire series at once. (This is a feature request.)
The text was updated successfully, but these errors were encountered:
importpandasaspdimportsquigglepyassqN=1000series=pd.Series(range(1, 5)) *sq.norm(mean=0, sd=1)
print(series.apply(lambdarow: sq.get_percentiles(row @ N, percentiles=[50]))) # worksprint(sq.get_percentiles(series @ N, percentiles=[50])) # would be nice if it did work
The first print statement will output a series of medians:
The second print statement does not work because you currently can't sample a series or data frame. I mostly want this as convenience, but it might also be possible to get performance benefits from doing this, since I believe you would get the performance benefits of vectorized operations (like multiply, etc.) when sampling?
(Of course the above example would also require get_percentiles to be vectorized in this way.)
A common use case here is that I have some time series of estimates represented as squigglepy distributions, and I want to get the medians and 5th and 95th percentiles (or w/e) for each row for plotting.
It would be nice to have a vectorized version of
sq.sample
. I often find myself having data frames or series that contain distributions, and when I want to expand those to medians and percentiles, I have to useapply
which is slow and a bit verbose. Nicer would be to be able to sample the entire series at once. (This is a feature request.)The text was updated successfully, but these errors were encountered: