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

Warnings (ambiguous getindex) #765

Closed
juliohm opened this issue Feb 9, 2015 · 11 comments
Closed

Warnings (ambiguous getindex) #765

juliohm opened this issue Feb 9, 2015 · 11 comments

Comments

@juliohm
Copy link
Contributor

juliohm commented Feb 9, 2015

Latest Julia:

using DataFrames

Warning: New definition
getindex(DataArrays.DataArray{T,N},Union(AbstractArray{T,1},Real)...) at /home/julio/.julia/v0.4/Compat/src/ngenerate.jl:53
is ambiguous with:
getindex(DataArrays.AbstractDataArray{T,N},Real) at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:104.
To fix, define
getindex(DataArrays.DataArray{T,N},Real)
before the new definition.
Warning: New definition
getindex(DataArrays.DataArray{T,N},Union(AbstractArray{T,1},Real)...) at /home/julio/.julia/v0.4/Compat/src/ngenerate.jl:53
is ambiguous with:
getindex(AbstractArray{T,N},Real) at abstractarray.jl:435.
To fix, define
getindex(DataArrays.DataArray{T,N},Real)
before the new definition.
Warning: New definition
getindex(DataArrays.PooledDataArray{T,R<:Integer,N},Union(AbstractArray{T,1},Real)...) at /home/julio/.julia/v0.4/Compat/src/ngenerate.jl:53
is ambiguous with:
getindex(DataArrays.AbstractDataArray{T,N},Real) at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:104.
To fix, define
getindex(DataArrays.PooledDataArray{T,R<:Integer,N},Real)
before the new definition.
Warning: New definition
getindex(DataArrays.PooledDataArray{T,R<:Integer,N},Union(AbstractArray{T,1},Real)...) at /home/julio/.julia/v0.4/Compat/src/ngenerate.jl:53
is ambiguous with:
getindex(AbstractArray{T,N},Real) at abstractarray.jl:435.
To fix, define
getindex(DataArrays.PooledDataArray{T,R<:Integer,N},Real)
before the new definition.
Warning: using DataFrames.describe in module Main conflicts with an existing identifier.

@juliohm juliohm changed the title Warnings Warnings (ambiguous getindex) Feb 9, 2015
@juliohm
Copy link
Contributor Author

juliohm commented Feb 9, 2015

This warning is probably causing a serious error:

df = DataFrame(x=[1,2,3],y=[4.,5.,6.])
df[:x,:y]

ERROR: MethodError: getindex has no method matching getindex(::DataFrames.DataFrame, ::Symbol, ::Symbol)
Closest candidates are:
getindex(::DataFrames.DataFrame, ::Real, ::Union(Symbol,Real))
getindex(::DataFrames.DataFrame, ::Union(Symbol,Real))
getindex{T<:Real}(::DataFrames.DataFrame, ::AbstractArray{T<:Real,1}, ::Union(Symbol,Real))
...

@tshort
Copy link
Contributor

tshort commented Feb 9, 2015

The getindex error message is not related to the warnings. It's telling you that your indexing method is incorrect. If you meant to select two columns, you can do that with:

df[ [:x, :y] ]

The extra brackets pass a vector of symbols to getindex.

@tshort
Copy link
Contributor

tshort commented Feb 9, 2015

Also, those method ambiguities are in the DataArrays package.

@juliohm
Copy link
Contributor Author

juliohm commented Feb 9, 2015

@tshort, I was able to use df[1:10,[:x,:y]] before the latest pull, now it doesn't work.

What is the correct way of querying these ranges in a dataframe now?

@tshort
Copy link
Contributor

tshort commented Feb 9, 2015

It works for me:

julia> d = DataFrame(a = rand(1:10,20), x = rand(20), y = rand(20));

julia> d[1:10, [:x,:y]]
10x2 DataFrame
| Row | x         | y         |
|-----|-----------|-----------|
| 1   | 0.649857  | 0.557144  |
| 2   | 0.57126   | 0.361365  |
| 3   | 0.676964  | 0.91767   |
| 4   | 0.0734608 | 0.0769796 |
| 5   | 0.676981  | 0.47995   |
| 6   | 0.688151  | 0.0860809 |
| 7   | 0.844548  | 0.166854  |
| 8   | 0.878062  | 0.457129  |
| 9   | 0.719522  | 0.0969891 |
| 10  | 0.927068  | 0.5675    |

@juliohm
Copy link
Contributor Author

juliohm commented Feb 9, 2015

This is the error I get:

ERROR: UndefVarError: I_1 not defined
in anonymous at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:30
in _getindex at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:141
in getindex at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:152
in getindex at /home/julio/.julia/v0.4/DataFrames/src/dataframe/dataframe.jl:239

and the version I'm using:

Julia Version 0.4.0-dev+3230
Commit 83bbfe4* (2015-02-09 16:47 UTC)
Platform Info:
System: Linux (x86_64-unknown-linux-gnu)
CPU: Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3

@tshort
Copy link
Contributor

tshort commented Feb 9, 2015

Is that with the same example I just gave? If not, please provide a
reproducible example.

On Mon, Feb 9, 2015 at 2:26 PM, Júlio Hoffimann Mendes <
notifications@github.com> wrote:

This is the error I get:

ERROR: UndefVarError: I_1 not defined
in anonymous at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:30
in _getindex at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:141
in getindex at /home/julio/.julia/v0.4/DataArrays/src/indexing.jl:152
in getindex at
/home/julio/.julia/v0.4/DataFrames/src/dataframe/dataframe.jl:239

and the version I'm using:

Julia Version 0.4.0-dev+3230
Commit 83bbfe4* (2015-02-09 16:47 UTC)
Platform Info:
System: Linux (x86_64-unknown-linux-gnu)
CPU: Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3


Reply to this email directly or view it on GitHub
#765 (comment)
.

@juliohm
Copy link
Contributor Author

juliohm commented Feb 9, 2015 via email

@tshort
Copy link
Contributor

tshort commented Feb 9, 2015

Looks like a bug. I don't have your setup handy. I recommend closing this
issue. Then open a new issue with that example and your result.

On Mon, Feb 9, 2015 at 2:34 PM, Júlio Hoffimann Mendes <
notifications@github.com> wrote:

Yes, the same example.


Reply to this email directly or view it on GitHub
#765 (comment)
.

@simonster
Copy link
Contributor

This is fallout from JuliaLang/julia#9098 in DataArrays. I'm working on it, but I may need @timholy's help.

@simonster
Copy link
Contributor

Should be fixed by JuliaLang/Compat.jl#42

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

3 participants