Table may look like the below:
| UID | Some measures |
|---|---|
| 1 | 500 |
| 2 | 300 |
| 3 | 100 |
| 4 | 50 |
| 5 | 50 |
I want to use SQL to sample based on the weight of the measure, let's say we want to sample 1 UID, then there should be 50% chance that the UID =1 got sampled.
Basically, implementing the pandas sample(pd.sample(weight = 'some measure') function using sql
pandas sample function: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.sample.html