Mastering Development

Group by and update value based on another column using python

I have a data frame with below columns, using which need to create new columns by grouping Name. Status should be updated as active to entire group if it is active for any one St. data = {‘Name’:[‘Tom’, ‘Tom’, ‘krish’, ‘jack’,’jack’,’Nam’,’sue’], ‘St’:[‘S-123’, ‘S-290’, ‘S-123’, ‘S-147′,’S-98′,’S-123′,’S-38’], ‘Status’:[‘Inactive’,’active’,’active’,’inactive’,’active’,’Inactive’,’Inactive’]} df = pd.DataFrame(data) The desired output is Name St […]