You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filter(ds::AbstractDataset, cols; [missings = missing, type = all,...])
972
972
973
973
A convenient shortcut for `ds[byrow(ds, type, cols; ...), :]`.
974
974
975
975
`type` can be any function supported by `byrow` which returns a Vector{Bool} or BitVector.
976
976
977
+
The `missings` keyword argument controls how the missing values should be treated in `filter`. Setting `missings = false` treats missing values as `false` and setting it as `true` treats missing values as `true`.
978
+
977
979
See [`byrow`](@ref), [`filter!`](@ref), [`delete!`](@ref), [`delete`](@ref)
978
980
979
981
# Examples
@@ -1036,42 +1038,106 @@ julia> filter(ds, 2:3, type = isless, with = :x)
1036
1038
1 │ 3 -1.0 true
1037
1039
2 │ 4 0.0 false
1038
1040
3 │ 5 2.0 true
1041
+
1042
+
julia> ds = Dataset(x = [1,2,missing,4,5], y = [missing,missing,-1,0,2.0], z = [true,missing,true,false,true])
function Base.filter(ds::AbstractDataset, cols::Union{NTuple{N, ColumnIndex}, Vector{T}, ColumnIndex, MultiColumnIndex}; view =false, type= all, kwargs...) where N where T <:Union{<:Integer, Symbol, AbstractString}
1077
+
function Base.filter(ds::AbstractDataset, cols::Union{NTuple{N, ColumnIndex}, Vector{T}, ColumnIndex, MultiColumnIndex}; missings::Union{Missing, Bool}=missing, view =false, type= all, kwargs...) where N where T <:Union{<:Integer, Symbol, AbstractString}
filter!(ds::AbstractDataset, cols; [type = all, ...])
1097
+
filter!(ds::AbstractDataset, cols; [missings = missing, type = all, ...])
1050
1098
1051
1099
Variant of `filter` which replaces the passed data set with the filtered one.
1052
1100
1053
1101
It is a convenient shortcut for `deleteat![ds, .!byrow(ds, type, cols; ...)]`.
1054
1102
1055
1103
`type` can be any function supported by `byrow` which returns a Vector{Bool} or BitVector.
1056
1104
1105
+
The `missings` keyword argument controls how the missing values should be treated in `filter!`. Setting `missings = false` treats missing values as `false` and setting it as `true` treats missing values as `true`.
1106
+
1057
1107
Refer to [`filter`](@ref) for exmaples.
1058
1108
1059
1109
See [`byrow`](@ref), [`filter`](@ref), [`delete!`](@ref), [`delete`](@ref)
1060
1110
"""
1061
-
_filter!(ds::Dataset, cols::Union{NTuple{N, ColumnIndex}, AbstractVector{T}, ColumnIndex, MultiColumnIndex}; type = all, kwargs...) where N where T <:Union{<:Integer, Symbol, AbstractString}=deleteat!(ds, .!byrow(ds, type, cols; kwargs...))
1062
-
Base.filter!(ds::Dataset, cols::AbstractVector; type = all, kwargs...) =_filter!(ds, cols; type = type, kwargs...)
1063
-
Base.filter!(ds::Dataset, cols::Union{ColumnIndex, MultiColumnIndex}; type = all, kwargs...) =_filter!(ds, cols; type = type, kwargs...)
1064
-
Base.filter!(ds::Dataset, cols::NTuple{N, ColumnIndex}; kwargs...) where N =_filter!(ds, cols; kwargs...)
1111
+
function_filter!(ds::Dataset, cols::Union{NTuple{N, ColumnIndex}, AbstractVector{T}, ColumnIndex, MultiColumnIndex}; missings =missing, type = all, kwargs...) where N where T <:Union{<:Integer, Symbol, AbstractString}
delete(ds::AbstractDataset, cols; [missings = missing, type = all,...])
1070
1134
1071
1135
A convenient shortcut for `ds[.!byrow(ds, type, cols; ...), :]`.
1072
1136
1073
1137
`type` can be any function supported by `byrow` which returns a Vector{Bool} or BitVector.
1074
1138
1139
+
The `missings` keyword argument controls how the missing values should be treated in `delete`. Setting `missings = false` treats missing values as `false` and setting it as `true` treats missing values as `true`.
1140
+
1075
1141
Compare to [`deleteat!`](@ref)
1076
1142
1077
1143
See [`delete!`](@ref), [`byrow`](@ref), [`filter!`](@ref), [`filter`](@ref)
@@ -1139,31 +1205,89 @@ julia> delete(ds, 2:3, type = isless, with = :x)
1139
1205
─────┼──────────────────────────────
1140
1206
1 │ 1 1.5 true
1141
1207
2 │ 2 2.3 false
1208
+
1209
+
julia> ds = Dataset(x = [1,2,missing,4,5], y = [missing,missing,-1,0,2.0], z = [true,missing,true,false,true])
functiondelete(ds::AbstractDataset, cols::Union{NTuple{N, ColumnIndex}, ColumnIndex, MultiColumnIndex}; view =false, type= all, kwargs...) where N
1240
+
functiondelete(ds::AbstractDataset, cols::Union{NTuple{N, ColumnIndex}, ColumnIndex, MultiColumnIndex}; missings::Union{Missing, Bool}=missing, view =false, type= all, kwargs...) where N
delete!(ds::AbstractDataset, cols; [type = all, ...])
1260
+
delete!(ds::AbstractDataset, cols; [missings = missing, type = all, ...])
1153
1261
1154
1262
Variant of `delete` which replaces the passed data set with the filtered one.
1155
1263
1156
1264
It is a convenient shortcut for `deleteat![ds, byrow(ds, type, cols; ...)]`.
1157
1265
1158
1266
`type` can be any function supported by `byrow` which returns a Vector{Bool} or BitVector.
1159
1267
1268
+
The `missings` keyword argument controls how the missing values should be treated in `delete!`. Setting `missings = false` treats missing values as `false` and setting it as `true` treats missing values as `true`.
1269
+
1160
1270
Compare to [`deleteat!`](@ref)
1161
1271
1162
1272
Refer to [`delete`](@ref) for exmaples.
1163
1273
1164
1274
See [`delete`](@ref), [`byrow`](@ref), [`filter`](@ref), [`filter!`](@ref)
1165
1275
"""
1166
-
Base.delete!(ds::Dataset, cols::Union{NTuple{N, ColumnIndex}, ColumnIndex, MultiColumnIndex}; type = all, kwargs...) where N =deleteat!(ds, byrow(ds, type, cols; kwargs...))
1276
+
function Base.delete!(ds::Dataset, cols::Union{NTuple{N, ColumnIndex}, ColumnIndex, MultiColumnIndex}; missings::Union{Missing, Bool}=missing, type = all, kwargs...) where N
0 commit comments