how to replace string with a number of characters in pandas code example
Example 1: pandas replace word begins with contains
df['sport'] = df.sport.str.replace(r'(^.*ball.*$)', 'ball sport')
df
Example 2: pandas replace word begins with contains
df.sport = df.sport.apply(lambda x: 'ball sport' if 'ball' in x else x)