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
!(leave in (:first, :last, :none, :xor, :nand, :nor, :and, :or)) &&throw(ArgumentError("`leave` must be either `:first`, `:last`, or `:none`"))
1056
+
!(leave in (:first, :last, :none, :random, :xor, :nand, :nor, :and, :or)) &&throw(ArgumentError("`leave` must be either `:first`, `:last`, `:none`, or `random`"))
1056
1057
ifncol(ds) ==0
1057
1058
throw(ArgumentError("finding duplicate rows in data set with no "*
Copy file name to clipboardExpand all lines: src/dataset/other.jl
+20-10Lines changed: 20 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -622,35 +622,41 @@ function _unique_none_case(ds::Dataset, cols; mapformats = false)
622
622
end
623
623
624
624
# Modify Dataset
625
-
function Base.unique!(ds::Dataset; mapformats =false, keep =:first)
626
-
!(keep in (:first, :last, :none, :only)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, or :none"))
625
+
function Base.unique!(ds::AbstractDataset; mapformats =false, keep =:first)
626
+
!(keep in (:first, :last, :none, :only, :random)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, :none, or :random"))
function Base.unique!(ds::Dataset, cols::AbstractVector; mapformats =false, keep =:first)
638
-
!(keep in (:first, :last, :none, :only)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, or :none"))
639
+
function Base.unique!(ds::AbstractDataset, cols::AbstractVector; mapformats =false, keep =:first)
640
+
!(keep in (:first, :last, :none, :only, :random)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, :none, or :random"))
function Base.unique!(ds::Dataset, cols; mapformats =false, keep =:first)
649
-
!(keep in (:first, :last, :none, :only)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, or :none"))
652
+
function Base.unique!(ds::AbstractDataset, cols; mapformats =false, keep =:first)
653
+
!(keep in (:first, :last, :none, :only, :random)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, :none, or :random"))
!(keep in (:first, :last, :none, :only)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, or :none"))
669
+
!(keep in (:first, :last, :none, :only, :random)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, :none, or :random"))
!(keep in (:first, :last, :none, :only)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, or :none"))
683
+
!(keep in (:first, :last, :none, :only, :random)) &&throw(ArgumentError( "The `keep` keyword argument must be one of :first, :last, :only, :none, or :random"))
Return a data set containing only the unique occurrence of unique rows in `ds` where `keep` can be one of the following value: `:first`, `:last`, `:none`, or `:only`. The
701
+
Return a data set containing only the unique occurrence of unique rows in `ds` where `keep` can be one of the following value: `:first`, `:last`, `:none`, `:only`, or `:random`. The
692
702
`keep` keyword argument detemines which occurrence of the unique value should be kept, i.e. when `keep = :first` the
693
703
first occurrence of the unique value will be kept and when `keep = :last` the last occurrence will be kept. When `keep` is set to `:none`
694
-
all duplicates will be dropped from the result, and when `keep` is set to `:only` only duplicated rows are kept.
704
+
all duplicates will be dropped from the result, when `keep` is set to `:only` only duplicated rows are kept, and when `keep` is set ot `:random` a random occurance of duplicates will be kept.
695
705
When `cols` is specified, the unique occurrence is detemined by given combination of values
696
706
in selected columns. `cols` can be any column selector.
0 commit comments