KnowledgeBoat Logo
|
LoginJOIN NOW

Informatics Practices

Write statement(s) to delete a column from a DataFrame.

Python Pandas

2 Likes

Answer

The statements to delete a column from a DataFrame is:

del <Df object>[<column name>]

OR

df.drop([<column name>], axis = 1).

For example, the statement to delete a column Population from a dataframe df is del df['Population] or df.drop('Population', axis = 1).

Answered By

1 Like


Related Questions