Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas drop unnamed columns

df = df.loc[:, ~df.columns.str.contains('^Unnamed')]

In [162]: df
Out[162]:
   colA  ColB  colC  colD  colE  colF  colG
0    44    45    26    26    40    26    46
1    47    16    38    47    48    22    37
2    19    28    36    18    40    18    46
3    50    14    12    33    12    44    23
4    39    47    16    42    33    48    38
Comment

drop all unnamed columns pandas

df.drop(df.columns[df.columns.str.contains('unnamed',case = False)],axis = 1, inplace = True)
Comment

remove unnamed columns pandas

df2.columns.str.match("Unnamed")
df2.loc[:,~df2.columns.str.match("Unnamed")]
Comment

PREVIOUS NEXT
Code Example
Python :: how to make print float value without scientific notation in dataframe in jupyter notebook 
Python :: conditional row delete pandas 
Python :: pyaudio not installing ubuntu 
Python :: pygame rect collisions 
Python :: plot image without axes python 
Python :: python remove non letters from string 
Python :: how to get image in jupyter notebook 
Python :: convert into date python 
Python :: unable to locate package python-pip 
Python :: pygame.rect parameters 
Python :: python read xlsb pandas 
Python :: python add datetime to filename 
Python :: get the torch version 
Python :: how to install mediapipe python 
Python :: hwo much does mano house cost in python 
Python :: terminal python version 
Python :: turn list to string with commas python 
Python :: python how to save a Seaborn plot into a file 
Python :: how to run python script as admin 
Python :: invert dictionary python 
Python :: check numpy version 
Python :: pandas shuffle rows 
Python :: python get filename from path 
Python :: pygame get mouse position 
Python :: cmd run ps1 file in background 
Python :: python add month datetime 
Python :: how ot split a string every fourth eter 
Python :: convert json to x-www-form-urlencoded pyhon 
Python :: install re package python 
Python :: numpy mean 2 arrays 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =