Answers for "remove column pandas dataframe"

85

drop a column pandas

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

drop a column from dataframe

#To delete the column without having to reassign df
df.drop('column_name', axis=1, inplace=True)
Posted by: Guest on August-25-2020
7

delete row from dataframe python

df.drop(df.index[-2])
df.drop(df.index[[3, 4]])
df.drop(['row_1', 'row_2'])
df.drop('column_1', axis=1)
df[df.name != 'cell']
Posted by: Guest on October-30-2020
3

drop column dataframe

df.drop(columns=['Unnamed: 0'])
Posted by: Guest on April-30-2020
0

remove columns from dataframe

df.drop('col_name',1) #1 drop column / 0 drop row
Posted by: Guest on August-10-2020
0

remove a column from dataframe

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

Code answers related to "remove column pandas dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language