Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

replace all spacec column with underscore in pandas

import pandas as pd 

# remove spaces in columns name
df.columns = df.columns.str.replace(' ','_')
Comment

pandas replace space with underscore in column names

df.rename(columns=lambda x: x.strip().replace(" ", "_"), inplace=True)
Comment

PREVIOUS NEXT
Code Example
Python :: solve system of linear equations numpy 
Python :: how to export data from mongodb python 
Python :: generate random list of number py 
Python :: parse list from string 
Python :: python remove n random elements from a list 
Python :: copy a file from one directroy to other using python 
Python :: python program to display the current date and time 
Python :: mad python 
Python :: how to invert a list in python 
Python :: add background image in django uploaded file 
Python :: python 3.9.5 installed update default version 
Python :: pandas read google sheet 
Python :: python version kali linux 
Python :: draw a circle in python turtle 
Python :: python get name of file 
Python :: green fuel 
Python :: python copy file to new filename 
Python :: from django.utils.translation import ugettext_lazy as _ 
Python :: python- find multiple values in a column 
Python :: python ceil 
Python :: python delete file with extension 
Python :: django rest framework default_authentication_classes 
Python :: drop nulll python 
Python :: pandas shift columns down until value 
Python :: python ignore unicodedecodeerror 
Python :: using while loop in python taking input until it matches the desired answer 
Python :: multiply all values in column pandas 
Python :: python gaussian elimination 
Python :: pyqt loading screen 
Python :: how to convert img to gray python 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =