The transform function does not remove duplicate rows. Implement logic to drop duplicates from the DataFrame.