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

v0.5 Julia removed fallback transpose and alternative does not work for DataFrames #1029

Closed
tlnagy opened this issue Aug 8, 2016 · 1 comment

Comments

@tlnagy
Copy link

tlnagy commented Aug 8, 2016

Since JuliaLang/LinearAlgebra.jl#257 went through, doing something like the following no longer works:

julia> versioninfo()
Julia Version 0.5.0-rc0+0
Commit 0030eec* (2016-07-26 20:22 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin15.4.0)
  CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

julia> Pkg.checkout("DataFrames")
INFO: Checking out DataFrames master...
INFO: Pulling DataFrames latest master...
INFO: No packages to install, update or remove

julia> using DataFrames
INFO: Recompiling stale cache file /Users/tamasnagy/.julia/lib/v0.5/DataFrames.ji for module DataFrames.

julia> a = DataFrame(rand(10,3))
10×3 DataFrames.DataFrame
│ Row │ x1        │ x2       │ x3        │
├─────┼───────────┼──────────┼───────────┤
│ 10.1040090.2886950.0858412 │
│ 20.1615720.5354730.7343    │
│ 30.9059770.5410490.675175  │
│ 40.4598020.198780.049148  │
│ 50.4698350.0297310.258061  │
│ 60.05753590.4948670.808683  │
│ 70.3277230.2253810.14324   │
│ 80.6289490.7263750.831952  │
│ 90.8831810.8084210.803585  │
│ 100.9273150.7776830.287885  │

julia> a'
WARNING: the no-op `transpose` fallback is deprecated, and no more specific `transpose` method for DataFrames.DataFrame exists. Consider `permutedims(x, [2, 1])` or writing a specific `transpose(x::DataFrames.DataFrame)` method if appropriate.
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in transpose(::DataFrames.DataFrame) at ./deprecated.jl:771
 in ctranspose(::DataFrames.DataFrame) at ./operators.jl:300
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:62
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:46
while loading no file, in expression starting on line 0
10×3 DataFrames.DataFrame
│ Row │ x1        │ x2       │ x3        │
├─────┼───────────┼──────────┼───────────┤
│ 10.1040090.2886950.0858412 │
│ 20.1615720.5354730.7343    │
│ 30.9059770.5410490.675175  │
│ 40.4598020.198780.049148  │
│ 50.4698350.0297310.258061  │
│ 60.05753590.4948670.808683  │
│ 70.3277230.2253810.14324   │
│ 80.6289490.7263750.831952  │
│ 90.8831810.8084210.803585  │
│ 100.9273150.7776830.287885

The suggested permutedims(a, [2, 1]) does not work

julia> permutedims(a, [2,1])
ERROR: MethodError: no method matching permutedims(::DataFrames.DataFrame, ::Array{Int64,1})
Closest candidates are:
  permutedims(::Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T,N},SubArray{T,N,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Any) at multidimensional.jl:775
  permutedims{T,N}(::AbstractArray{T,N}, ::Any) at permuteddimsarray.jl:47
@tlnagy
Copy link
Author

tlnagy commented Aug 9, 2016

It turns out that I was mistaken and this pattern did not work on 0.4 either. What broke was doing something like the following

julia> using DataFrames

julia> A = rand([:a, :b], 2, 4)
2x4 Array{Symbol,2}:
 :b  :b  :a  :b
 :b  :a  :a  :a

julia> DataFrame(A')
4×2 DataFrames.DataFrame
│ Row │ x1 │ x2 │
├─────┼────┼────┤
│ 1   │ b  │ b  │
│ 2   │ b  │ a  │
│ 3   │ a  │ a  │
│ 4   │ b  │ a  │

This no longer works, but this is not directly due to the DataFrames package so I'm going to close this issue.

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