# Custom row indexing in DataFrames

**URL:** https://discourse.julialang.org/t/custom-row-indexing-in-dataframes/53959
**Category:** Data
**Tags:** question
**Created:** [January 26, 2021, 8:23am UTC](https://discourse.julialang.org/t/custom-row-indexing-in-dataframes/53959 "2021-01-26T08:23:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Impressium](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/impressium/32/19575_2.png) [@Impressium](https://discourse.julialang.org/u/Impressium)
#### Post date: [January 26, 2021, 8:23am UTC](https://discourse.julialang.org/t/custom-row-indexing-in-dataframes/53959/1 "2021-01-26T08:23:05Z")

</div>

Hey everybody 🙂

Given a DataFrame `df` with columns `I`, `A` and `C`. Is there an way to set `I` as row index such that I can use `df[i,:]`or `df[i,a]` with `i in I` and `a in A`.

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [January 26, 2021, 1:48pm UTC](https://discourse.julialang.org/t/custom-row-indexing-in-dataframes/53959/2 "2021-01-26T13:48:03Z")

</div>

No, that is not possible in DataFrames.

You can do `groupby(df, :I)` or `groupby(df, [:I, :A])` and index this object, but when indexed it will return a `SubDataFrame` not a single row.

---

<div class="post-metadata">

### Author: ![Impressium](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/impressium/32/19575_2.png) [@Impressium](https://discourse.julialang.org/u/Impressium)
#### Post date: [January 28, 2021, 6:04pm UTC](https://discourse.julialang.org/t/custom-row-indexing-in-dataframes/53959/3 "2021-01-28T18:04:17Z")

</div>

Is that something what we need?
