queryverse / tabletraitsutils.jl Goto Github PK
View Code? Open in Web Editor NEWUtilities for implementing the TableTraits.jl interfaces
License: Other
Utilities for implementing the TableTraits.jl interfaces
License: Other
If I have a csv file like so:
col1,col2
foo,
And then do:
using DataFrames, CSVFiles
csv = load("error.csv")
df = DataFrame(csv)
Then I get the following stack trace:
ERROR: LoadError: MethodError: Cannot `convert` an object of type DataValues.DataValue{Union{}} to an object of type Missing
Closest candidates are:
convert(::Type{Missing}, ::Any) at missing.jl:50
convert(::Type{Union{Missing, T}}, ::DataValues.DataValue{Union{}}) where T at /home/hertz/.julia/packages/DataValues/dOAy1/src/scalar/core.jl:38
convert(::Type{Union{Missing, T}}, ::DataValues.DataValue{T}) where T at /home/hertz/.julia/packages/DataValues/dOAy1/src/scalar/core.jl:37
...
Stacktrace:
[1] convert(::Type{Missing}, ::DataValues.DataValue{Union{}}) at ./missing.jl:50
[2] setindex!(::Array{Missing,1}, ::DataValues.DataValue{Union{}}, ::Int64) at ./array.jl:769
[3] _fill_cols_with_length(::Tuple{Array{String,1},Array{Missing,1}}, ::TableTraitsUtils.TableIterator{NamedTuple{(:col1, :col2),Tuple{String,DataValues.DataValue{Union{}}}},Tuple{WeakRefStrings.StringArray{String,1},Array{Missing,1}}}) at /home/hertz/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:74
[4] #create_columns_from_iterabletable#6(::Symbol, ::Symbol, ::Function, ::CSVFiles.CSVFile) at /home/hertz/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:114
[5] #create_columns_from_iterabletable at ./none:0 [inlined]
[6] _DataFrame(::CSVFiles.CSVFile) at /home/hertz/.julia/packages/IterableTables/T74aY/src/integrations/dataframes.jl:13
[7] DataFrame(::CSVFiles.CSVFile) at /home/hertz/.julia/packages/IterableTables/T74aY/src/integrations/dataframes.jl:22
[8] top-level scope at none:0
[9] include at ./boot.jl:317 [inlined]
[10] include_relative(::Module, ::String) at ./loading.jl:1038
[11] include(::Module, ::String) at ./sysimg.jl:29
[12] include(::String) at ./client.jl:398
[13] top-level scope at none:0
in expression starting at mwe.jl:3
This used to work in 0.6. My environment is up to date:
[5d742f6a] CSVFiles v0.9.0
[a93c6f00] DataFrames v0.13.0
[5789e2e9] FileIO v1.0.1
[59287772] Formatting v0.3.2
[739be429] MbedTLS v0.6.0
[5fb14364] OhMyREPL v0.3.0
[295af30f] Revise v0.6.4
Glen
Iterators work fine so long as you have data, but if you don't it all breaks - the problem seems to be here rather than in IterableTables - possibly that there are no columns in an empty table:
julia> using DataFrames, IterableTables
julia> df = DataFrame()
0ร0 DataFrame
julia> it = getiterator(df)
TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}(())
julia> length(it)
ERROR: BoundsError: attempt to access ()
at index [1]
Stacktrace:
[1] getindex(::Tuple{}, ::Int64) at ./tuple.jl:24
[2] length(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:27
[3] top-level scope at none:0
julia> iterate(it)
ERROR: BoundsError: attempt to access ()
at index [1]
Stacktrace:
[1] getindex(::Tuple{}, ::Int64) at ./tuple.jl:24
[2] length(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:27
[3] macro expansion at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:41 [inlined]
[4] iterate(::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}, ::Int64) at /Users/richardr/.julia/packages/TableTraitsUtils/GTAd/src/TableTraitsUtils.jl:33 (repeats 2 times)
[5] top-level scope at none:0
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.