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

pandas rename columns whitespace with underscore

dataframe.columns = list(map(lambda x: x.replace(' ', '_'),
                                 dataframe.columns))
Comment

PREVIOUS NEXT
Code Example
Python :: python gettext 
Python :: convert numpy to torch 
Python :: python repeat every n seconds 
Python :: increase xlabel font size matplotlib 
Python :: python delete folder 
Python :: sns figsize 
Python :: auto datetime in django models 
Python :: import mean squared log error 
Python :: export image python 
Python :: matplotlib text too small 
Python :: how to right click in pyautogui 
Python :: export file csv python 
Python :: python listdir with full paths 
Python :: erode dilate opencv python 
Python :: checking django version 
Python :: python rotate pdf pages 
Python :: python time.strptime milliseconds 
Python :: spacy en_core_web_sm error 
Python :: python tkinter underline text 
Python :: installing django 
Python :: python savefig full screen 
Python :: how to open a software using python 
Python :: pip install numpy 
Python :: tkiner border 
Python :: python bytes to dict 
Python :: python discord bot join voice channel 
Python :: from string to time python dataframe 
Python :: install re package python 
Python :: convert mp3 to wav python 
Python :: how to clear a command line python 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =