<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
I am trying to find duplicates rows in a pandas dataframe.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
df=pd.DataFrame(data=[[1,2],[3,4],[1,2],[1,4],[1,2]],columns=['col1','col2'])
def g(df):
    df['index_original'] = df.groupby(['col1', 'col2']).col1.transform('idxmax')
    for i in range(len(df)):
        i = len(df) - 1 - i
        origin = df.loc[i, 'index_original']
        if i <= origin:
            continue
        if origin == df.loc[origin, 'index_original']:
            df.loc[origin, 'index_original'] = i
        df.loc[i, 'index_original'] = df.loc[origin, 'index_original']
    return df[df.duplicated(subset=['col1', 'col2'], keep='last')]
result = g(df.copy())
<END_TASK>