Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 1cd77da

Browse files
tkelmanararslan
authored andcommitted
Fix WeightVec deprecation from StatsBase 0.15 (#254)
* Fix WeightVec deprecation from StatsBase 0.15 * enable travis on 0.6 for master
1 parent c27e356 commit 1cd77da

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: julia
22
julia:
3-
# - 0.6
3+
- 0.6
44
- nightly
55
os:
66
- linux

REQUIRE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
julia 0.6.0-pre
22
Compat 0.8.6
3-
StatsBase 0.14.0
3+
StatsBase 0.15.0
44
Reexport
55
SpecialFunctions

src/extras.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function StatsBase.addcounts!{T,U}(cm::Dict{U,Int}, x::AbstractDataArray{T})
55
return cm
66
end
77

8-
function StatsBase.addcounts!{T,U,W}(cm::Dict{U,W}, x::AbstractDataArray{T}, wv::WeightVec{W})
8+
function StatsBase.addcounts!{T,U,W}(cm::Dict{U,W}, x::AbstractDataArray{T}, wv::Weights{W})
99
n = length(x)
1010
length(wv) == n || raise_dimerror()
1111
w = values(wv)
@@ -23,7 +23,7 @@ function StatsBase.countmap{T}(x::AbstractDataArray{T})
2323
addcounts!(Dict{Union{T, NAtype}, Int}(), x)
2424
end
2525

26-
function StatsBase.countmap{T,W}(x::AbstractDataArray{T}, wv::WeightVec{W})
26+
function StatsBase.countmap{T,W}(x::AbstractDataArray{T}, wv::Weights{W})
2727
addcounts!(Dict{Union{T, NAtype}, W}(), x, wv)
2828
end
2929

src/reduce.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Base.std(A::DataArray; corrected::Bool=true, mean=nothing, skipna::Bool=false) =
175175

176176
## weighted mean
177177

178-
function Base.mean(a::DataArray, w::WeightVec; skipna::Bool=false)
178+
function Base.mean(a::DataArray, w::Weights; skipna::Bool=false)
179179
if skipna
180180
v = a .* w.values
181181
sum(v; skipna=true) / sum(DataArray(w.values, v.na); skipna=true)
@@ -184,7 +184,7 @@ function Base.mean(a::DataArray, w::WeightVec; skipna::Bool=false)
184184
end
185185
end
186186

187-
function Base.mean{W,V<:DataArray}(a::DataArray, w::WeightVec{W,V}; skipna::Bool=false)
187+
function Base.mean{W,V<:DataArray}(a::DataArray, w::Weights{W,V}; skipna::Bool=false)
188188
if skipna
189189
v = a .* w.values
190190
sum(v; skipna=true) / sum(DataArray(w.values.data, v.na); skipna=true)

0 commit comments

Comments
 (0)