No method matching getindex for XLSX?

I have been trying to progress with the tutorials from Julia Academy, this time with the Data Science tutorial (here). I am trying to use the first notebook (Data.ipynb) with the Jupyter facilities within VS Code. I chose VS Code, as I couldn’t (still) build some packages that were meant to be used in the tutorial (see this topic).

The notebook appears to correctly load the package XLSX and I am able to load the Zillow table:

G is meant to be a tuple with two elements. When I try to access the first element (G[1]), I am greeted with the following error message:

What is really going on here???

What’s going on is that since v0.11 XLSX.jl doesn’t return a tuple any longer but a Tables.jl compatible table. That’s what the error is telling you - the thing you’re indexing into is not a tuple but a XLSX.DataTable.

You can turn this table into a DataFrame by just calling DataFrame(G)


Thanks @nilshg . In that case, may I suggest that the tutorial(s) get updated, because some of the content is misleading (as shown above).

That’s tricky of course with video content - normally the best thing to do is to just provide a Manifest file so that people can recreate the tutorial with the same package versions used when the tutorial was made, but I’m not sure whether that’s available in this case.

Looks like the “tutorial” for XLSX.jl also needs some updating (this was correct for version 0.7.2; XLSX is now 0.8.4):


But you are looking at the documentation for version 0.7.2 (see the URL in your screenshot), for which DataFrame(XLSX.readtable(...)...) is the correct way of getting a DataFrame from an Excel file. It clearly wouldn’t be sensible to change the documentation for older versions of a package to match the API of newer versions, which wouldn’t be applicable for the older version.

Here’s the section “Read Tabular Data” for the current (“stable”) version of the package:

This correctly omits the splatting operator from the call to DataFrame, reflecting the new return type of XLSX.readtable. The older docs you are looking at are here:

and correctly describe how to construct a DataFrame from XLSX.readtable with older XLSX versions.