Calculate probability that normal distribution sample is smallest in group polars python
I have a polars dataframe along the lines of: df = pl.DataFrame( { "group": [1, 1, 1, 2, 2, 2, 2], "mean": [25.5, 25.2, 24.9, 50.5, 55.1, 54.2, 60], "std": [2.5, 3.5, 1.7, 10.2, 5.5, 7.8, 20.5], } ) For each row we have a mean and standard deviation for a normal distribution. I'd like to add a column which represents the probability that when sampling, that row would have the lowest value in its group. It is a strict requirement that the column is added with an expression which can be entered into a with_columns call. I was able to write the following: def probability_smallest_in_group(series)
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.