Replace value of a column if the value of another column is a duplicate I have a Pandas dataframe that contains three columns: ID, name and date. The name column is not unique and may contain duplicates. I want to change the date of the duplicated name to the earliest date. For example:
Input:
id  name    date
1   Rachel  3/10/2020
2   Dave    1/5/2020
3   Rachel  1/10/2020
4   Rachel  1/1/2020
5   Jason   4/15/2020
6   Dave    7/1/2020

Output:
id  name    date
1   Rachel  1/1/2020
2   Dave    1/5/2020
3   Rachel  1/1/2020
4   Rachel  1/1/2020
5   Jason   4/15/2020
6   Dave    1/5/2020

In the sample data above, there are three dates associated to Rachel, the earliest date is 1/1/2020, therefore, in the output, all the dates associated to Rachel are changed to 1/1/2020.
A cleaner way would be:
df[&quot;date&quot;] = df.groupby(&quot;name&quot;).date.transform(&quot;min&quot;)

Outputs: