Answers for "how to drop unnecessary columns in pandas"

18

drop multiple columns pandas

yourdf.drop(['columnheading1', 'columnheading2'], axis=1, inplace=True)
Posted by: Guest on May-16-2020
2

pandas drop empty columns

DataFrameName.dropna(axis=1, how='all', inplace=True)
Posted by: Guest on March-12-2021
1

drop unamed columns in pandas

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
Posted by: Guest on December-04-2020

Code answers related to "how to drop unnecessary columns in pandas"

Python Answers by Framework

Browse Popular Code Answers by Language