Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No bounds check in df[i, :] with zero-column data frames #1608

Closed
nalimilan opened this issue Nov 25, 2018 · 3 comments
Closed

No bounds check in df[i, :] with zero-column data frames #1608

nalimilan opened this issue Nov 25, 2018 · 3 comments

Comments

@nalimilan
Copy link
Member

The second call should also throw a BoundsError:

julia> DataFrame(x=[])[1, :]
┌ Warning: Selecting a single row from a `DataFrame` will return a `DataFrameRow` in the future. To get a `DataFrame` use `df[row_ind:row_ind, :]`.
│   caller = top-level scope at none:0
└ @ Core none:0
ERROR: BoundsError: attempt to access 0-element Array{Any,1} at index [1]
Stacktrace:
 [1] getindex(::Array{Any,1}, ::Int64) at ./array.jl:739
 [2] getindex(::DataFrame, ::Int64, ::Colon) at /home/milan/.julia/dev/DataFrames/src/dataframe/dataframe.jl:288
 [3] top-level scope at none:0

julia> DataFrame()[1, :]
┌ Warning: Selecting a single row from a `DataFrame` will return a `DataFrameRow` in the future. To get a `DataFrame` use `df[row_ind:row_ind, :]`.
│   caller = top-level scope at none:0
└ @ Core none:0
0×0 DataFrame
@bkamins
Copy link
Member

bkamins commented Dec 3, 2018

We have four problematic behaviors:

DataFrame()[1, :]
DataFrame()[1:2, :]
DataFrame()[1, Bool[]]
DataFrame()[1:2, Bool[]]

I will fix them after we merge #1603 not to mess up to much with it.

Fortunately SubDataFrame is OK.

@bkamins
Copy link
Member

bkamins commented Dec 10, 2018

In #1603 I have fixed it in commit e87bf5a

@bkamins
Copy link
Member

bkamins commented Dec 14, 2018

I think we can close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants