JuliaData / JuliaData/JSONTables.jl
Heterogeneous data sometimes detect wrong columns type
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 71
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
There are combinations of heterogeneus data where the wrong column types are discovered.
For example:
using JSONTables
using Tables
nonhomogenous = """
[
{"a": 1, "b": 2, "c": 3},
{"b": 4, "c": 8, "d": 5}
]
"""
JSONTables.jsontable(nonhomogenous)
You got:
JSONTables.Table{false, JSON3.Array{JSON3.Object, Base.CodeUnits{UInt8, String}, Vector{UInt64}}}([:a, :b, :c, :d], Dict{Symbol, Type}(:a => Union{Missing, Int64}, :b => Int64, :d => Int64, :c => Int64), JSON3.Object[{
"a": 1,
"b": 2,
"c": 3
}, {
"b": 4,
"c": 8,
"d": 5
}])
d type is detected as Int64 and this throws an error when building a table:
ct = Tables.columntable(jt)
ERROR: MethodError: Cannot `convert` an object of type Missing to an object of type Int64
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied nonhomogeneous JSON example and the JSONTables.jsontable call, then run Tables.columntable on the resulting table to reproduce the conversion error. Trace how column types are detected for fields absent from some rows; done means the example builds a table without a Missing-to-Int64 conversion failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100