The Remove command is used to remove columns from a DataFrame:
>
|
|
The following removes the second column of the DataFrame:
It is also possible to remove multiple columns of a DataFrame:
>
|
|
It is possible to remove rows in a DataFrame using the mode option:
>
|
|
The Remove command does not act inplace. In order to permanently remove a column, reassignment is needed.
The Remove command is helpful when dealing with DataFrames that have a mixture of non-numeric and numeric columns. For example, the Iris data set has 4 columns of numeric data and one column of strings.
>
|
|
Attempting to plot or run any statistical analysis on this dataset as is will often result in an error due to the non-numeric data. Removing the non-numeric data for analysis avoids this issue.
>
|
|