As stated in the comments, here is a way to list with each entry shown as many times as the weight indicates. I think this is not the smartest solution, and someone can come up with the best one.
My example applies only to column A, but you can use it in the same way in column B:
import matplotlib.pyplot as plt weighted_appearances = [] for index, row in df.iterrows(): weighted_row = [row.ColA]*row.ColA_weights weighted_appearances += weighted_row plt.boxplot(weighted_appearances) plt.show()
Pros: a very simple writing solution, theoretically working in all cases (if your weights are not integers, you will have to convert / bypass them in the way you think is acceptable)
Cons: not very effective, if you work with really large weights, you will need to find a way to "collapse" those that will have a reasonable use of memory.
Loicm
source share