-
Notifications
You must be signed in to change notification settings - Fork 37
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
DataArrays lead to TypeError in the Table constructor #87
Comments
Note that the problem regards only the first column, i.e. this work:
|
There are some odd behavior with NA value using DataArrays, JuliaDB
a = @data([NA,1,2,3])
t1 = table(a, names=[:a])
t1[1] # MethodError
rows(t1) # Error displaying But it works fine if column name is not defined t2 = table(a)
t2[1]
rows(t2) |
This is because of: julia> eltype(DataArrays.DataArray{Int64, 1})
Int64 It should really be |
Some options here:
I do wish this just worked. |
So Thanks for your help! |
Yeah, that will work too. As long as the array type doesn't lie about its element type, we're in business. We will be switching JuliaDB over to |
Just a minor comment here. So actually the issue with |
@YongHee-Kim You might be able to see why |
@andreasnoack Thank you for the tip! It seems |
This should work smoothly by just loading IterableTables.jl and then doing something like this: using DataFrames, IndexedTables, IterableTables
df = DataFrame(
param = ["price","price","price","price","waterContent","waterContent"],
item = ["banana","banana","apple","apple","banana", "apple"],
region = ["FR","UK","FR","UK","",""],
value = [3.2,2.9,1.2,0.8,0.2,0.8]
)
df[5,:region] = NA
df[6,:region] = NA
it = table(df) IterableTables.jl will handle all the various different representations of missing data that float around. In general when things get converted via that route I just respect what a given container sees as its default representation for missing data, and then convert accordingly. Only caveat is that I haven't merged the support for DataFrames.jl v0.11 yet, but that should happen relatively soon (and then it will work with both the old and new DataFrames at the same time). |
Hello,
I am trying to convert a DataFrame with NA values as IndexedTable, e.g.:
I did try to construct the Table from vectors where there are NA values, but the constructor fails:
However if I add NA values once the IndexedTable is created, it works great.
So, in split of possible performance problems, I thought of first creating an empty IndexedTable, and then "append" to it, but it seems that when you construct an empty IndexedTable, this object misbehaves:
So, which is the preferred way to deal with IndexedTables when some dimensions may present NA values ?
The text was updated successfully, but these errors were encountered: