Skip to content

Commit 451f37b

Browse files
authored
Use levels from DataAPI (#216)
1 parent 13dfc1c commit 451f37b

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
1414

1515
[compat]
1616
julia = "1"
17-
Missings = ">= 0.4.2"
17+
DataAPI = "1.1"
18+
Missings = ">= 0.4.3"
1819

1920
[extras]
2021
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ leveltype(::Type{T}) where {T <: CategoricalArray} = leveltype(catvaluetype(T))
561561
Return the levels of categorical array `A`. This may include levels which do not actually appear
562562
in the data (see [`droplevels!`](@ref)).
563563
"""
564-
Missings.levels(A::CategoricalArray) = levels(A.pool)
564+
DataAPI.levels(A::CategoricalArray) = levels(A.pool)
565565

566566
"""
567567
levels!(A::CategoricalArray, newlevels::Vector; allow_missing::Bool=false)

src/pool.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ function levels!(pool::CategoricalPool{S, R}, newlevels::Vector) where {S, R}
280280
end
281281

282282
index(pool::CategoricalPool) = pool.index
283-
Missings.levels(pool::CategoricalPool) = pool.levels
283+
DataAPI.levels(pool::CategoricalPool) = pool.levels
284284
order(pool::CategoricalPool) = pool.order
285285

286286
isordered(pool::CategoricalPool) = pool.ordered

src/subarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# delegate methods for SubArrays to support view
22

3-
Missings.levels(sa::SubArray{T,N,P}) where {T,N,P<:CategoricalArray} = levels(parent(sa))
3+
DataAPI.levels(sa::SubArray{T,N,P}) where {T,N,P<:CategoricalArray} = levels(parent(sa))
44
isordered(sa::SubArray{T,N,P}) where {T,N,P<:CategoricalArray} = isordered(parent(sa))
55
# This method cannot support allow_missing=true since that would modify the parent
66
levels!(sa::SubArray{T,N,P}, newlevels::Vector) where {T,N,P<:CategoricalArray} =

0 commit comments

Comments
 (0)