determine unique rows in a DataFrame
AreUnique( data )
options : (optional) equation(s) of the form option=value where option can be keep.
keep : first, last, none; if a duplicate row is encountered, keep specifies which duplicate row to mark as unique
The AreUnique command returns a DataSeries of type truefalseFAIL, where the elements correspond to true if the corresponding row is unique and false if the given row is a duplicate of another row in the given DataFrame.
The output from the AreUnique command can be used to index a DataSeries or DataFrame in order to return the unique rows.
The keep option controls how duplicate rows are handled. By default, keep marks the first instance of a row as unique (true) and marks all repeated rows of any previously marked unique rows as duplicate (false). If keep is set to last, the last detected duplicate row is marked as unique and all other repeated rows are marked as duplicates. If keep is set to none, all rows that have duplicates are marked as duplicate (false).
The following DataFrame has one duplicate row; the fourth row is the same as the first.
DF ≔ DataFrame⁡1,1,2,1,3,4|6,5,1,6,9,9|4,2,1,4,8,3
The AreUnique command returns a truefalseFAIL DataSeries that shows duplicate rows as false and unique rows as true.
If the DataFrame is indexed by the result, a filtered DataFrame is returned that removes any duplicate rows:
The keep option allows for specification of which row to keep (either the first, last or none) when a duplicate row is found:
If keep is set to none, any row that has a duplicate is marked as a duplicate (false).
The AreUnique command can also be used on individual DataSeries in a DataFrame. This allows for the removal of the rows that have duplicate values in a specific column.
The DataFrame/AreUnique command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document