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

(Possible) Bug with shuffle when shuffling DataFrame rows #3211

Closed
lfenzo opened this issue Oct 29, 2022 · 2 comments
Closed

(Possible) Bug with shuffle when shuffling DataFrame rows #3211

lfenzo opened this issue Oct 29, 2022 · 2 comments

Comments

@lfenzo
Copy link

lfenzo commented Oct 29, 2022

Reproducing directly from the shuffle documentation yields the following:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.3 (2022-05-06)
 _/ |\__'_|_|_|\__'_|  |  Fedora 36 build
|__/                   |

julia> using DataFrames

julia> using Random

julia> rng = MersenneTwister(1234);

julia> shuffle!(rng, DataFrame(a=1:5, b=1:5))
ERROR: MethodError: no method matching shuffle!(::MersenneTwister, ::DataFrame)
Closest candidates are:
  shuffle!(::AbstractRNG, ::AbstractArray) at /usr/share/julia/stdlib/v1.7/Random/src/misc.jl:214
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

julia> methods(shuffle!)
# 3 methods for generic function "shuffle!":
[1] shuffle!(r::AbstractRNG, a::AbstractArray) in Random at /usr/share/julia/stdlib/v1.7/Random/src/misc.jl:214
[2] shuffle!(a::AbstractArray) in Random at /usr/share/julia/stdlib/v1.7/Random/src/misc.jl:228
[3] shuffle!(perm::Pkg.Resolve.NodePerm) in Pkg.Resolve at /usr/share/julia/stdlib/v1.7/Pkg/src/Resolve/maxsum.jl:227

julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
@bkamins
Copy link
Member

bkamins commented Oct 29, 2022

You are most likely not using DataFrames.jl 1.4.2, which is a current release (and the link you gave is for this release currently).
Can you please check on what version of DataFrames.jl you are?
(and if it is not 1.4.2 can you please report the reason - maybe some other package is holding the update back for you)

@bkamins bkamins closed this as completed Oct 29, 2022
@lfenzo
Copy link
Author

lfenzo commented Oct 29, 2022

Good point! I'm currently using DataFrames 1.3.6:

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [c9ce4bd3] ArchGDAL v0.9.2
  [c7e460c6] ArgParse v1.1.4
  [fbb218c0] BSON v0.3.5
  [6e4b80f9] BenchmarkTools v1.3.1
  [336ed68f] CSV v0.10.7
  [052768ef] CUDA v3.12.0
  [13f3f980] CairoMakie v0.9.1
  [a93c6f00] DataFrames v1.3.6
  [1313f7d8] DataFramesMeta v0.12.0
  [864edb3b] DataStructures v0.18.13
  [e30172f5] Documenter v0.27.23
  [5789e2e9] FileIO v1.16.0
  [587475ba] Flux v0.13.7
  [7bf95e4d] FluxTraining v0.3.4
  [f7bf1975] Impute v0.6.8
  [033835bb] JLD2 v0.4.25
  [add582a8] MLJ v0.18.6
  [49802e3a] ProgressBars v1.4.1
  [295af30f] Revise v3.4.0
  [321657f4] ScientificTypes v3.0.2
  [1277b4bf] ShiftedArrays v2.0.0
  [b3cc710f] StaticLint v8.1.0
  [2913bbd2] StatsBase v0.33.21
  [69024149] StringEncodings v0.3.5
  [bd369af6] Tables v1.10.0
  [a5390f91] ZipFile v0.10.0
  [9a3f8284] Random

(@v1.7) pkg> update
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/.julia/environments/v1.7/Project.toml`
  No Changes to `~/.julia/environments/v1.7/Manifest.toml`

Since I had recently updated the packages I was expecting most of them to be up to date, however I didn't check it. As you pointed out, it seems that some package is holding back the update.

Thanks @bkamins!

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