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

get rid of unnamed column pandas

df.to_csv(path, index=False)
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 :: python pandas csv append 
Python :: python3 shebang line 
Python :: matplotlib animate 
Python :: remove new line character from string python 
Python :: declaring variables in python 
Python :: _ variable in python 
Python :: where is python installed on ubuntu 
Python :: python turtle spiral 
Python :: create qr code in python 
Python :: discord python tts 
Python :: python optional parameters 
Python :: python if condition assignment in one line 
Python :: matplotlib pyplot comment on plot 
Python :: merge dicts python 
Python :: button tkinter 
Python :: soap 1.2 request python 
Python :: builtwith python 
Python :: pd.read_csv 
Python :: how to count things in a list python 
Python :: auto slug field django 
Python :: How to know size of Python list 
Python :: windows error message python 
Python :: python download complete web page 
Python :: python dictionary append 
Python :: Math Module tan() Function in python 
Python :: how to get the link of an image in selenium python 
Python :: get request body flask 
Python :: pandas create a new column based on condition of two columns 
Python :: tensor.numpy() pytorch gpu 
Python :: spacy tokineze stream 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =