ExcelFiles.jl icon indicating copy to clipboard operation
ExcelFiles.jl copied to clipboard

DataFrame(load("file.xlsx", "sheetname")) not working

Open cossio opened this issue 6 years ago • 1 comments

After a recent update in DataFrames v0.18, the line DataFrame(load("file.xlsx", "sheetname")) no longer works to read an Excel file into a DataFrame. I get the following error:

ArgumentError: no default Tables.columns implementation for type: ExcelFiles.ExcelFile

Stacktrace: [1] #DataFrame#365(::Bool, ::Type, ::ExcelFiles.ExcelFile) at .julia/packages/Tables/qlc3J/src/fallbacks.jl:156 [2] DataFrame(::ExcelFiles.ExcelFile) at .julia/packages/DataFrames/dXFYy/src/other/tables.jl:20

It seems ExcelFiles needs to update to use the Tables API.

cossio avatar May 01 '19 20:05 cossio

AFAICT that's a problem in Tables.jl. Since https://github.com/JuliaData/Tables.jl/pull/84, Tables.columns checks Base.isiterable(T) instead of istable(x), which doesn't take into account TableTraits.isiterabletable(x). Yet ExcelFile defines the latter, but not the former.

I have a possible fix at https://github.com/JuliaData/Tables.jl/pull/89.

nalimilan avatar May 02 '19 08:05 nalimilan