# How to get the row index of a csv file using \`\`\`for row in CSV.File(filename)\`\`\`?

**URL:** <https://discourse.julialang.org/t/how-to-get-the-row-index-of-a-csv-file-using-for-row-in-csv-file-filename/20113>\
**Category:** General Usage\
**Created:** [January 25, 2019, 11:41pm UTC](https://discourse.julialang.org/t/how-to-get-the-row-index-of-a-csv-file-using-for-row-in-csv-file-filename/20113 "2019-01-25T23:41:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [January 25, 2019, 11:41pm UTC](https://discourse.julialang.org/t/how-to-get-the-row-index-of-a-csv-file-using-for-row-in-csv-file-filename/20113/1 "2019-01-25T23:41:43Z")

</div>

Hi, I plan to read a .csv file using `for row in CSV.File(filename)` like the following:

```julia
for row in CSV.File(filename) 
      # parse the information stored in this row to a vector of my defined type
end

```

Now, I need to know the row index. Is there a simple way to get the row index from this setting?  
Thank you.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [January 25, 2019, 11:44pm UTC](https://discourse.julialang.org/t/how-to-get-the-row-index-of-a-csv-file-using-for-row-in-csv-file-filename/20113/2 "2019-01-25T23:44:52Z")

</div>

for (i, row) in enumerate(…)

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [January 25, 2019, 11:47pm UTC](https://discourse.julialang.org/t/how-to-get-the-row-index-of-a-csv-file-using-for-row-in-csv-file-filename/20113/3 "2019-01-25T23:47:58Z")

</div>

@dpsanders, you mean

```julia
for (i,row) in enumerate(CSV.File(filename))

```

?
