NLP-with-Python icon indicating copy to clipboard operation
NLP-with-Python copied to clipboard

ValueError: 'a' must be greater than 0 unless no samples are taken

Open QABoahene opened this issue 5 years ago • 0 comments

I was trying to use this same concept for my dataset and got the error in the title. Could anybody help? I also checked the shape of the dataframe which was (56, 11).

The error message is below:


ValueError Traceback (most recent call last) in 1 print('5 random songs with the highest positive sentiment polarity: \n') ----> 2 hps = data.loc[data['polarity'] == 0.3, ['titles']].sample().values 3 for h in hps: 4 print(h[0])

~/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py in sample(self, n, frac, replace, weights, random_state, axis) 5059 ) 5060 -> 5061 locs = rs.choice(axis_length, size=n, replace=replace, p=weights) 5062 return self.take(locs, axis=axis) 5063

mtrand.pyx in mtrand.RandomState.choice()

ValueError: 'a' must be greater than 0 unless no samples are taken

QABoahene avatar Dec 28 '20 20:12 QABoahene