Pretium interview question

python dataframe weighted average, some probability with finance background setup