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 :: get screen size python 
Python :: delete rows based on condition python 
Python :: window size cv2 
Python :: how to export a string as txt file in python 
Python :: remove axis in a python plot 
Python :: renaming headers pandasd 
Python :: python gettext 
Python :: get diroctary in python 
Python :: loop through list backwards python 
Python :: ipykernel pip 
Python :: pandas dropna specific column 
Python :: python os remove file 
Python :: distance between point python 
Python :: django import Q 
Python :: python listdir with full paths 
Python :: mac install python 3.8 
Python :: Installing python cryptography 
Python :: print colored text python 
Python :: open pkl file python 
Python :: standardscaler into df data frame pandas 
Python :: change column order dataframe python 
Python :: shuffle dataframe python 
Python :: linux ubuntu install python 3.7 
Python :: pandas add suffix to column names 
Python :: matplotlib y axis log scale 
Python :: save and load catboost model 
Python :: plural name django 
Python :: tick labels vertical matplotlib 
Python :: pandas change last row 
Python :: how to hit enter in selenium python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =