Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas replace word begins with contains

df.sport.str.replace(r'(^.*ball.*$)', 'ball sport')

0        tennis
1    ball sport
2    ball sport
Name: sport, dtype: object
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #replace #word #begins
ADD COMMENT
Topic
Name
3+1 =