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

Online Help

All Products    Maple    MapleSim


DataFrame/AreUnique

determine unique rows in a DataFrame

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

AreUnique( data )

Parameters

data

-

DataFrame

options

-

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

Options

• 

keep : first, last, none;  if a duplicate row is encountered, keep specifies which duplicate row to mark as unique

Description

• 

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

Examples

The following DataFrame has one duplicate row; the fourth row is the same as the first.

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

DF123116421523211416453986493

(1)

The AreUnique command returns a truefalseFAIL DataSeries that shows duplicate rows as false and unique rows as true.

AreUniqueDF

1true2true3true4false5true6true

(2)

If the DataFrame is indexed by the result, a filtered DataFrame is returned that removes any duplicate rows:

DFAreUniqueDF

12311642152321153986493

(3)

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

DFAreUniqueDF,keep=first

12311642152321153986493

(4)

DFAreUniqueDF,keep=last

12321523211416453986493

(5)

If keep is set to none, any row that has a duplicate is marked as a duplicate (false).

DFAreUniqueDF,keep=none

1232152321153986493

(6)

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.

DFAreUniqueDF1,keep=first

1231164321153986493

(7)

Compatibility

• 

The DataFrame/AreUnique command was introduced in Maple 2016.

• 

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

See Also

AreDuplicate

type/truefalseFAIL