-
Notifications
You must be signed in to change notification settings - Fork 10
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
Error converting from JSONTables to DataFrame #7
Comments
You'll have to provide more details; both these examples work for me: julia> DataFrame(jsontable("""{
"a": [1,2,3],
"b": [4.1, null, 6.3],
"c": ["7", "8", null]
}"""))
3×3 DataFrame
│ Row │ a │ b │ c │
│ │ Int64 │ Float64⍰ │ String⍰ │
├─────┼───────┼──────────┼─────────┤
│ 1 │ 1 │ 4.1 │ 7 │
│ 2 │ 2 │ missing │ 8 │
│ 3 │ 3 │ 6.3 │ missing │
julia> DataFrame(jsontable("""[
{"a": 1, "b": 4.1, "c": "7"},
{"a": 2, "b": null, "c": "8"},
{"a": 3, "b": 6.3, "c": null}
]"""))
3×3 DataFrame
│ Row │ a │ b │ c │
│ │ Int64 │ Float64⍰ │ String⍰ │
├─────┼───────┼──────────┼─────────┤
│ 1 │ 1 │ 4.1 │ 7 │
│ 2 │ 2 │ missing │ 8 │
│ 3 │ 3 │ 6.3 │ missing │
|
Oh yes, this example works for me as well. Where it was tripping me up before was julia> text |> println
{
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"dictionary": "Packages/Language - English/en_US.dic",
"draw_white_space": "all",
"font_face": "monospace 821",
"font_size": "10",
"theme": "Adaptive.sublime-theme"
}
julia> DataFrame(jsontable(text))
ERROR: MethodError: no method matching size(::String)
Closest candidates are:
size(::BitArray{1}) at bitarray.jl:77
size(::BitArray{1}, ::Any) at bitarray.jl:81
size(::Core.Compiler.StmtRange) at show.jl:1561
... Do the angle braces Thanks again. |
Ah, so in this case, your json input isn't a table; currently for JSONTables.jl, your json input needs to be an "object of arrays" or an "array of objects". I've put up a PR to better validate the input json, so you don't get the weird |
Fix #7 by adding an additional validation check on columnar json sources
Hi,
Thanks for writing this package. Right now I am an encountering this error while trying the example in README.md
text
here is aString
of the json source. Not sure if it has something to do withDataFrames
. Also my package versions areThanks.
The text was updated successfully, but these errors were encountered: