Answers for "pandas dataframe delete column name"

85

delete column pandas dataframe

df.drop(['column_1', 'Column_2'], axis = 1, inplace = True)
Posted by: Guest on November-08-2020
1

delete columns pandas

df = df.drop(df.columns[[0, 1, 3]], axis=1)
Posted by: Guest on August-22-2020
0

remove a column from dataframe

del df['column_name'] #to remove a column from dataframe
Posted by: Guest on July-20-2020
0

remove name of a column

M
      a b c
1[1,] 1 4 7
2[2,] 2 5 8
3[3,] 3 6 9

row.names(M)<- NULL ; colnames(M)<- NULL
M

     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9
Posted by: Guest on May-25-2021
0

remove columns that start with pandas

cols = [c for c in df.columns if c.lower()[:6] != 'string']
df=df[cols]
Posted by: Guest on March-16-2021
0

remove a columns in pandas

DataFrame.drop(self, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')[source]
Posted by: Guest on May-31-2020

Code answers related to "pandas dataframe delete column name"

Python Answers by Framework

Browse Popular Code Answers by Language