# Subsetting Rles

Rles can be subsetted using an integer (or a list of integers) to get the RLE value at one or more points.

```{python tidy=FALSE}
from pyrle import Rle
r = Rle([3, 2, 1, 1, 1, 1], [0, 1, 2, 1, 0, 1])
print(r)
print(r[2], r[3])
print(r[[3, 5, 7]])
```

To get the slice of one or more run lengths use a slice or a dataframe with (at
least) the columns Start and End.


```{python tidy=FALSE}
import pandas as pd
from pyrle import Rle
r = Rle([3, 2, 1, 1, 1, 1], [0, 1, 2, 1, 0, 1])

print(r[5:10])

df = pd.DataFrame({"Start": [2, 5], "End": [4, 900]})
print(df.to_csv(index=False, sep="\t"))
print(r[df], end="\n")
```
