determine unique elements in a DataSeries
AreUnique( data )
options : (optional) equation(s) of the form option=value where option can be any of keep.
keep : first, last, none; if a duplicate element is encountered, keep specifies which duplicate to retain
The AreUnique command returns a DataSeries of type truefalseFAIL where the elements correspond to true if the given element is unique and false if the given element is a duplicate of another value in the given DataSeries.
The output from the AreUnique command can be used to index a DataSeries or DataFrame in order to return the unique rows in a given column.
The keep option allows for specification of which duplicate element value in the DataSeries to keep. By default, keep marks the first instance of a value that it encounters as unique (true) and marks any duplicates of this first instance as a duplicate (false). If keep is set to last, the last detected duplicate value is marked as unique (true) and any other matching values are marked as duplicate (false). If keep is set to none, any elements that have duplicates are marked as duplicates (false).
DS ≔ DataSeries⁡1,2,3,3,4,5,5,5
The AreUnique command returns a truefalseFAIL DataSeries that shows all unique values as true.
If the DataSeries is indexed by the result, a filtered DataSeries is returned that removes any duplicate values:
The results can be used to index a DataFrame and remove the rows that have duplicate values in a specific column.
DF ≔ DataFrame⁡1,1,2,3,3,4|5,3,6,2,1,4|6,5,1,4,9,9|4,2,1,7,8,3
The keep option allows for specification of which row to keep, either the first, last or none, when a duplicate is found:
If keep is set to none, all rows that have a duplicate value in a column are marked as false.
The DataSeries/AreUnique command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document
What kind of issue would you like to report? (Optional)