DataFrames don't have real row indexes. If you want a row identifier, you
can add it as an extra column.
On Aug 23, 2015 4:32 PM, "Robert Smith" <[email protected]> wrote:

> Very silly question. In Julia 0.3, I noticed that after slicing some
> DataFrame, the resulting object doesn't keep its original indexes. For
> example:
>
> julia> using DataFrames
>
> julia> df = DataFrame(x=1:100)
>
> julia> df[20:50,:]
> 31x1 DataFrame
> | Row | x  |
> |-----|----|
> | 1   | 20 |
> | 2   | 21 |
> | 3   | 22 |
> | 4   | 23 |
> | 5   | 24 |
> | 6   | 25 |
> | 7   | 26 |
> | 8   | 27 |
> ⋮
> | 23  | 42 |
> | 24  | 43 |
> | 25  | 44 |
> | 26  | 45 |
> | 27  | 46 |
> | 28  | 47 |
> | 29  | 48 |
> | 30  | 49 |
> | 31  | 50 |
>
> In the previous line, the DataFrame's indexes start with 1 instead of 20.
> Is there a way to keep the same index as the original DataFrame (this is
> the default behavior in Pandas and R).
>
> Thanks.
>

Reply via email to