Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

replacing pandas drop duplicates functionality

wonka1234
10 - Fireball

Hi,

 

Is there a way to replicate pandas drop duplicates on all columns?

Is this the same as using Unique on all columns?

 

Thanks.

4 REPLIES 4
SoccerTil
8 - Asteroid

From what I can see about Pandas drop duplicates, Alteryx Unique will perform the same as the drop duplicates with the First option. The drop duplicates by default will be based on all columns. You can select them all or if you only require a subset of columns then select just those. To replicate the Last option you would need to number your rows and then sort them descending first. To replicate the False option, you will need to use additional data analytics. If this doesn't help, you can supply a test input and output data set with your drop duplicates statement.

atcodedog05
22 - Nova
22 - Nova

Hi @wonka1234 

 

Pandas function

DataFrame.drop_duplicates(subset=None, keep='first', inplace=False, ignore_index=False)

 

Another approach is you can also use a sample tool to get the first 1 row for each group or the last 1 row for each group. This way you can keep 1st occurrence or last occurrence.

 

atcodedog05_1-1641539200086.png

 

inplace=False is similar as taking data from the previous step (original copy) and after drop (new copy)

 

ignore_index=False and indexes are not used in Alteryx

 

Hope this helps : )

 

mutama
Alteryx
Alteryx

Hi @wonka1234 , in addition to the suggestions provided by @atcodedog05 and @SoccerTil, you may also refer to the Alteryx Tool Mastery Guide here regarding the detailed, step-by-step explanation on how to use each tool (e.g. Unique, Sample etc): https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Index/ta-p/84593

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @wonka1234 

Cheers and have a nice day!

Labels