Let us say we have a dataset with a feature such as Surname.
arr['Surname'] = ['Smith', 'Jones', 'Johnson', 'Smith']
And I want to encode this categorical info as a new feature like
arr['Surname_Count'] = [2, 1, 1, 2]
with the caveat that it is done within an Sklearn pipeline. Are there quick ways to do this that do not involve rolling my own partition counting transformer?