Python sample function TypeError: '<' not supported between instances of 'str' and 'int'
Welcome to the site!

I've checked the issue, it's because you are trying to create a sample using a str variable.(df['A']). df.sample cannot create a sample by assigning weights to categorical variable.

I made a small work around i.e.,

df = pd.DataFrame(dict( A=['a', 'a', 'a', 'b', 'c', 'c', 'c', 'a', 'b', 'b', 'b', 'c', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'], B=range(20) ))

#converting the text into categorical codes which are in numeric
df['cat'] = df.A.astype('category').cat.codes

#creating a sample using newly created column
Output = df.sample(n=100,weights = 'cat',replace=True)


Output would have 100 records and created using 'cat' for weights.