Question: I have a data frame according to below:

```

id_1  id_2  value
1     0     1
1     1     2
1     2     3
2     0     4
2     1     1
3     0     5
3     1     1
4     0     5
4     1     1
4     2     6
4     3     7  
11    0     8
11    1     14
13    0     10
13    1     9 

```

I would like to take out a random sample of size n, without replacement, from this table based on *id\_1*. This row needs to be unique with respect to the *id\_1* column and can only occur once. 

End result something like:

```

id_1  id_2  value
1     1     2
2     0     4
4     3     7
13    0     10

```

I have tried to do a group by and use the indices to take out a row through *random.sample* but it dosent go all the way. 

Can someone give me a pointer on how to make this work? Code for DF below!

As always, thanks for time and input!

/swepab

```
df = pd.DataFrame({'id_1' : [1,1,1,2,2,3,3,4,4,4,4,11,11,13,13],
               'id_2' : [0,1,2,0,1,0,1,0,1,2,3,0,1,0,1],
               'value_col' : [1,2,3,4,1,5,1,5,1,6,7,8,14,10,9]})

```

Answer: 
In, Swift 3 you can try this.

```
let swipeRightOrange = UISwipeGestureRecognizer(target: self, action:#selector(slideToRightWithGestureRecognizer))
swipeRightOrange.direction = UISwipeGestureRecognizerDirection.Right;

let swipeLeftOrange:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(slideToLeftWithGestureRecognizer))
swipeLeftOrange.direction = UISwipeGestureRecognizerDirection.Left;

@IBAction func  slideToLeftWithGestureRecognizer(gestureRecognizer:UISwipeGestureRecognizer)
{
viewOrange.backgroundColor = UIColor.blueColor()
}
@IBAction func slideToRightWithGestureRecognizer
(gestureRecognizer:UISwipeGestureRecognizer)
{
viewOrange.backgroundColor = UIColor.lightGrayColor()
}

```
```
    func holeSwiped(gesture: UISwipeGestureRecognizer)
    {
    if let swipeGesture = gesture as? UISwipeGestureRecognizer{
    switch swipeGesture.direction {
    case UISwipeGestureRecognizerDirection.right:
        NSLog("right swipe")
    case UISwipeGestureRecognizerDirection.left:
        NSLog("left swipe")
    default:
        NSLog("other swipe")
    }
   }
  }

```