remove columns or rows in a DataFrame
Remove( df, index, options )
name, string, integer or list; specifies the index of the column (or columns) to remove from the DataFrame
mode : name; specifies whether to remove columns or rows. The default is column. This option is entered in the form mode = m, where m is one of column, columns, row, or rows.
The Remove command removes a chosen column or row or a list of columns or rows from a DataFrame.
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.
IrisData≔Sepal LengthSepal WidthPetal LengthPetal WidthSpecies126.96.36.199.2setosa24.931.40.2setosa188.8.131.52.2setosa184.108.40.206.2setosa5220.127.116.11setosa18.104.22.168.4setosa22.214.171.124.3setosa8126.96.36.199setosa188.8.131.52.2setosa184.108.40.206.1setosa⋮⋮⋮⋮⋮⋮150 x 5 DataFrame
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.
The DataFrame/Remove command was introduced in Maple 2017.
For more information on Maple 2017 changes, see Updates in Maple 2017.
select, remove, and selectremove
Download Help Document
What kind of issue would you like to report? (Optional)