3. How to remove column from DataFrame using del statement:

HOME PAGE

3. How to remove column from DataFrame using del statement: -

The del statement can also be used to remove the column from DataFrame.

Note : del statement can remove only one column.

Syntax to use the del statement to remove the column from DataFrame: -

Any column label that we want to remove from DataFrame

del DataFrame_object[column_label]

Example 1 to remove column from DataFrame using del statement : -

Remove points1 column from given DataFrame

points1 column will be removed from DataFrame

OUTPUT: -

Example 2 to remove column from DataFrame using del statement : -

Remove Name column from given DataFrame

del df1['Name']

`Name' column will be removed from DataFrame

OUTPUT: -

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download