0

I have a Data Frame, which has a column that shows repeated values. It was the result of an inverse "explode" operation... trello_dataframe = trello_dataframe.groupby(['Card ID', 'ID List'], as_index=True).agg({'Member (Full Name)': lambda x: x.tolist()})

How do I remove duplicate values in each row of the column?

I attach more information: https://prnt.sc/RjGazPcMBX47

I would like to have the data frame like this: https://prnt.sc/y0VjKuewp872

Thanks in advance!

1 Answer 1

1

You will need to target the column and with a np.unique

import pandas as pd import numpy as np data = { 'Column1' : ['A', 'B', 'C'], 'Column2' : [[5, 0, 5, 0, 5], [5,0,5], [5]] } df = pd.DataFrame(data) df['Column2'] = df['Column2'].apply(lambda x : np.unique(x)) df 
Sign up to request clarification or add additional context in comments.

3 Comments

The column 2 looks familiar to me somewhere :D
Hi, ArchAngelPwn, Great! It works perfectly! Thank you very much!
No problem, glad to help! If you liked the answer please make sure to hit the "answered" so others might be able to find the answer as well

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.