this is my dataframe
df = pd.DataFrame({'Col1':['Joe','Bob','Joe','Joe'],
'Col2':[55,25,88,80]})
I only need names if they appear more than once in 'Col1'
I can do it like this:
grouped = df.groupby("Col1")
grouped.filter(lambda x: x["Col1"].count()>2)['Col1'].unique()
However this is ugly code
Is there an easier way to clean it?
source
share