Question: I have two columns. ID and Percentage. Some IDs are not unique. Assume I have IDs 233, 233, 277, 277. And corresponding percentages: 4,5%, 7%, 3%, 1%. I need to select max. percentage for each ID. So that outcome is: 233 - 7%, 277 - 3%. 

I wrote code that returns max value for the whole column, not the specific non-unique ID.

```
df['help_column'] = np.where(df.duplicated() ==True, max(df['percentage']),0)

```

As the highest value in the whole column is 33%, I get 33% for ID 233, and 33% for ID 277 instead of desired result. Thanks

Answer: 
This is more like a `transform` 

```
df['help_column'] = df.groupby('ID')['percentage'].transform('max')

```
Try this

```
df.groupby(['ID'])['percentage'].max()

```