Juergen D
Juergen D

Reputation: 29

Question about Julia version 1.8 and XLSX

I used Julia 1.7 The command dfc = DataFrame(XLSX.readtable("data.xlsx","sheet1")...) worked good

After migrating to Julia 1.8 the same command stopped working and generated the following error message:

ERROR: MethodError: no method matching iterate(::XLSX.DataTable)
Closest candidates are:
  iterate(!Matched::Union{LinRange, StepRangeLen}) at range.jl:872
  iterate(!Matched::Union{LinRange, StepRangeLen}, !Matched::Integer) at range.jl:872
  iterate(!Matched::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at dict.jl:712

what has changed with that command with the new release?

Looking forward to some information

Upvotes: 1

Views: 267

Answers (1)

Nils Gudat
Nils Gudat

Reputation: 13800

This has nothing to do with the Julia version you are using, and everything with the XLSX.jl version you are using. The XLSX documentation actually has a while section devoted to this here. The relevant bit for you is that readtable now returns a Tables.jl compatible table and so can passed into the DataFrame constructor directly, so instead of

DataFrame(XLSX.readtable(myfile, sheet)...)

You do

DataFrame(XLSX.readtable(myfile, sheet))

(note the lack of the splatting operator)

Note that these kinds of issues are expected when you move between breaking releases of a package according to Semver, so either between major releases (version 1.x to version 2.x) or between minor releases pre 1.0 (eg 0.5.x to 0.6.x). If you want to avoid these issues you should work with project specific environments so that the Manifest records the versions of all packages you are using and they don't change unless you manually do ] up for that specific environment.

Upvotes: 4

Related Questions