'Replace Street Names (Strings) with Letters in alphabetical order

So i have a dataset with a few columns. However, one column is made out of locations, in this case street names. I would like to rename those to just one letter. So for example:

Location Location new
Beukenlaan A
Deventerlaan B
Crixstraat C
Deventerlaan B

I have to do this for multiple datasheets so the function below would take a lot of time to adjust manually.

df.replace('Eindhoven Genovevalaan', 'A', regex=True, inplace=True)

Any ideas how to do this automatically?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source