def ResampleRowsWeighted(df, column='finalwgt'):
 weights = df[column]
 cdf = Cdf(dict(weights))
 indices = cdf.Sample(len(weights))
 sample = df.loc[indices]
 return sample

def ResampleRowsWeighted ( df , column = 'finalwgt' ) : weights = df [ column ] cdf = Cdf ( dict ( weights ) ) indices = cdf . Sample ( len ( weights ) ) sample = df . loc [ indices ] return sample
resamples a dataframe using probabilities proportional to given column .