This must be a simple question, but, however, it is bugging my head for a while.
For a dataframe below:
df = pd.DataFrame({\'c0\': [\'a\',\'b\',\'a\'
Use GroupBy.transform for Series with same size like original DataFrame:
df1 = df[df.groupby(['c0','c1'])['c2'].transform('count') > 1]
Or use DataFrame.duplicated for filtered all dupe rows by specified columns in list:
df1 = df[df.duplicated(['c0','c1'], keep=False)]
If performance is in not important or small DataFrame use DataFrameGroupBy.filter:
df1 = df.groupby(['c0','c1']).filter(lambda x: len(x) > 1)