replace str contains 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)