Skip to content

Commit 6a232bc

Browse files
bkaminsnalimilan
authored andcommitted
add deleteat! (#176)
1 parent eebecd2 commit 6a232bc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/array.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,3 +790,5 @@ end
790790

791791
refs(A::CategoricalArray) = A.refs
792792
pool(A::CategoricalArray) = A.pool
793+
794+
Base.deleteat!(A::CategoricalArray, inds) = (deleteat!(A.refs, inds); A)

test/13_arraycommon.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,4 +1094,13 @@ end
10941094
end
10951095
end
10961096

1097+
@testset "deleteat!" begin
1098+
x = ['a':'z';]
1099+
y = categorical(x)
1100+
deleteat!(x, [1, 3])
1101+
deleteat!(y, [1, 3])
1102+
@test x == y
1103+
@test levels(y) == 'a':'z'
1104+
end
1105+
10971106
end

0 commit comments

Comments
 (0)