Skip to content

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

Open
@QABoahene

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions