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

DataFrames #240

Closed
ymer opened this issue Sep 3, 2023 · 3 comments
Closed

DataFrames #240

ymer opened this issue Sep 3, 2023 · 3 comments

Comments

@ymer
Copy link

ymer commented Sep 3, 2023

The tutorial says I should read to a DataFrame like this:
DataFrame(XLSX.readtable("myfile.xlsx", "mysheet"))

However, this gives an error:

using DataFrames, XLSX
df = DataFrames.DataFrame(integers=[1, 2, 3, 4], strings=["Hey", "You", "Out", "There"])
XLSX.writetable("df.xlsx", df)

DataFrame(XLSX.readtable("df.xlsx", "Sheet1"))

While this works:

(cols, colnames) = XLSX.readtable("df.xlsx", "Sheet1")
df = DataFrame(cols, Symbol.(colnames))
@jvigneron
Copy link

With the latest versions (DataFrames v1.6.1 & XLSX v0.10.0) , your first example works as expected but the second one thows an error :

  (cols, colnames) = XLSX.readtable("df.xlsx", "Sheet1") # ERROR: MethodError: no method matching iterate(::XLSX.DataTable)

@nilshg
Copy link

nilshg commented Dec 11, 2023

This sounds like you're just on an old version of XLSX.jl - it used to return a data/column names tuple (so you had to do DataFrame(XLSX.readtable("myfile.xlsx", 1)...)) but since version 0.8 it returns a Tables.jl compatible object so you can construct the DataFrame directly, see:

https://felipenoris.github.io/XLSX.jl/dev/migration/#Migrating-Legacy-Code-to-v0.8

Please check ] st in the environment in which you are running your code. If you can reproduce your issue on the latest XLSX version (0.10) please report back here, otherwise the issue can be closed.

@nilshg
Copy link

nilshg commented May 22, 2024

This is probably good to close?

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

4 participants