Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remove extra blank spaces

df = pd.DataFrame({'Name':['Bertug     Mete','a','Joe    Black']})
print (df)
              Name
0  Bertug     Mete
1                a
2     Joe    Black

df.Name = df.Name.replace(r's+', ' ', regex=True)
#similar solution
#df.Name = df.Name.str.replace(r's+', ' ')
print (df)
          Name
0  Bertug Mete
1            a
2    Joe Black
Comment

PREVIOUS NEXT
Code Example
Python :: python typing list of specific values 
Python :: python merge two list 
Python :: Socket Programming Server Side 
Python :: how to find unique sublist in list in python 
Python :: bot delete embed py 
Python :: python check if included in list 
Python :: python catch any exception 
Python :: dictionary comprehension python 
Python :: DIVAB Solution 
Python :: py how to replace a string in a list 
Python :: tkinter change button color smoothly 
Python :: cosine similarity python 
Python :: glob.glob python 
Python :: group by dataframe 
Python :: guardar plot python 
Python :: python draw tree 
Python :: character in python 
Python :: compound interest python 
Python :: pandas shape 
Python :: values missing comparing datasets 
Python :: df describe 
Python :: dockerize django app 
Python :: list of dictionary values 
Python :: How To Let Your Main Window Appear after succesful login in Tkinter 
Python :: pandas turn column of list into binary 
Python :: python map function 
Python :: import in python 
Python :: python heighest int Value 
Python :: trim all new rows string python 
Python :: path selecter in tkinter 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =