Find Unique Elements - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DataSeries/AreUnique

determine unique elements in a DataSeries

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

AreUnique( data )

Parameters

data

-

DataSeries

options

-

options : (optional) equation(s) of the form option=value where option can be any of keep.

Options

• 

keep : first, last, none; if a duplicate element is encountered, keep specifies which duplicate to retain

Description

• 

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).

Examples

DSDataSeries1,2,3,3,4,5,5,5

DS1122334354657585

(1)

The AreUnique command returns a truefalseFAIL DataSeries that shows all unique values as true.

AreUniqueDS

1true2true3true4false5true6true7false8false

(2)

If the DataSeries is indexed by the result, a filtered DataSeries is returned that removes any duplicate values:

DSAreUniqueDS

1122335465

(3)

The results can be used to index a DataFrame and remove the rows that have duplicate values in a specific column.

DFDataFrame1,1,2,3,3,4|5,3,6,2,1,4|6,5,1,4,9,9|4,2,1,7,8,3

DF1234115642135232611432475319864493

(4)

AreUniqueDF1

1true2false3true4true5false6true

(5)

The keep option allows for specification of which row to keep, either the first, last or none, when a duplicate is found:

DFAreUniqueDF1,keep=first

123411564326114324764493

(6)

DFAreUniqueDF1,keep=last

123421352326115319864493

(7)

If keep is set to none, all rows that have a duplicate value in a column are marked as false.

DFAreUniqueDF1,keep=none

12343261164493

(8)

Compatibility

• 

The DataSeries/AreUnique command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

AreDuplicate

type/truefalseFAIL