vendredi 31 août 2018

How do I filter out random sample from dataframe in which there are different sample size for each value, in python?

Hi I am newbie to python,

I have to filter out random sample from Data on which:

'a' should have 6 values,

'b' should have 4 values and

'c' should have 7 values randomly.

Data    Value

a       1

a       2

a       3

a       4

a       5

a       6

a       7

a       8

a       9

a       10

b       1

b       2

b       3

b       4

b       5

b       6

b       7

b       8

b       9

c       1

c       2

c       3

c       4

c       5

c       6

c       7

c       8

I want output as:

Data Value

a     3

a     5

a     7

a     2

a     4

a     9

b     3

b     5

b     7

b     8

c     1

c     3

c     4

c     5

c     6

c     7

c     9




Aucun commentaire:

Enregistrer un commentaire