Skip to content

'a' must be greater than 0 unless no samples are taken #10

Open

Description

@Jameshu229

In [22]:

15

data.sample(15)


ValueError Traceback (most recent call last)
in
----> 1 data.sample(15)

c:\users\administrator\appdata\local\programs\python\python37-32\lib\site-packages\pandas\core\generic.py in sample(self, n, frac, replace, weights, random_state, axis)
4863 "provide positive value.")
4864
-> 4865 locs = rs.choice(axis_length, size=n, replace=replace, p=weights)
4866 return self.take(locs, axis=axis, is_copy=False)
4867

mtrand.pyx in mtrand.RandomState.choice()

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

这是怎么回事啊?

Activity

  1. lsyarn commented on Sep 11, 2019

    @lsyarn

    Check data.shape。I got the same problem, then i found i was calling sample for an empty Dataframe。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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