I have this function here which I use to replace the a string like this 'ABCDe.CO'
with 'ABCD-E.CO'
in a pandas dataframe.
I don't understand how the group(0) part works, I can't find any documentation on it. Could someone explain to me what this function does or where I can read up on it?
(df.loc[df.country.eq('ST'), 'ticker'].str.replace('([a-z])', lambda x: '-'+x.group(0).upper()))