How to find grouped mean with column retention?

I’m currently working on a data analysis project using Pandas, and I’m trying to find an efficient way to compute the grouped mean of a column in a dataframe while retaining all other columns. Specifically, I want to group the data based on one column, calculate the mean of another column for each group, and keep all other columns in the dataframe. However, I’m facing difficulty in achieving this task using Pandas, and I’m looking for alternative ways to solve this problem. Any help or suggestions would be greatly appreciated. Please let me know if any additional information is required.