Skip to content
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

Issue with reduce with named columns in JuliaDB #160

Closed
zlewko opened this issue Sep 21, 2019 · 3 comments
Closed

Issue with reduce with named columns in JuliaDB #160

zlewko opened this issue Sep 21, 2019 · 3 comments

Comments

@zlewko
Copy link

zlewko commented Sep 21, 2019

I'm trying to use OnlineStats with JuliaDB am unable to get it working with named columns. I'm not sure if this is an issue with OnlineStats or JuliaDB or just isn't expected to work this way...

using JuliaDB
using OnlineStats

t1 = table(rand(10), rand(10))
reduce(2Mean(),t1) 
#no error


t2 = table(rand(10), rand(10), names=[:a,:b])
reduce(2Mean(),t2) 
#Error:  The input for Group is a Union{NamedTuple{names,Tuple{Number,Number}}, Tuple{Number,Number}, AbstractArray{#s28,1} where #s28<:Number} where names.  Found Float64.```
@joshday
Copy link
Owner

joshday commented Sep 21, 2019

Ah, not sure how I never came across this myself. Looks like it has to do with some named tuple strangeness. I'll try to fix it.

julia> (1,2) isa Tuple{Number, Number}
true

julia> (a=1,b=2) isa NamedTuple{names, Tuple{Number,Number}} where names
false

@joshday
Copy link
Owner

joshday commented Sep 21, 2019

Fixed with OnlineStatsBase master:

julia> t2 = table(rand(10), rand(10), names=[:a,:b]);

julia> reduce(2Mean(),t2)
Group
  ├── Mean: n=10 | value=0.550865
  └── Mean: n=10 | value=0.294161

@zlewko
Copy link
Author

zlewko commented Sep 21, 2019

Thanks! It's working for me now.

@zlewko zlewko closed this as completed Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants