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

delete unnamed coloumns in pandas

# Best method so far.
df = df.loc[:, ~df.columns.str.contains('^Unnamed')]
Comment

get rid of unnamed column pandas

df.to_csv(path, index=False)
Comment

remove unnamed 0 column pandas

df.to_csv(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 :: argument sequence in python function 
Python :: convert pascal annotation to yolo 
Python :: python random from normal distribution 
Python :: count words python 
Python :: how to get the current web page link in selenium pthon 
Python :: python create n*n matrix 
Python :: zipfile python 
Python :: how to see the functions of a library in python 
Python :: how to get a list of followers on instagram python 
Python :: python string list to float 
Python :: chech box in tkinter 
Python :: mnist fashion dataset 
Python :: where my python modules in linux 
Python :: today date python 
Python :: df count missing values 
Python :: multiple args for pandas apply 
Python :: print key of dictionary python 
Python :: how to downgrade a package python 
Python :: get ip from request django 
Python :: printing with colors 
Python :: get output of ps aux grep python 
Python :: python plot_confusion_matrix 
Python :: python tkinter listbox click event 
Python :: replace nan in pandas 
Python :: strftime python 
Python :: django override help text 
Python :: how to increase and decrease volume of speakers using python 
Python :: upgrade python to 3.9 i linux 
Python :: how to input multiple integers in python 
Python :: you are trying to access thru https but only allows http django 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =