DataFrame/Remove - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Statistics and Data Analysis : DataFrames and DataSeries : DataFrame Commands : DataFrame/Remove

DataFrame/Remove

remove columns or rows in a DataFrame

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Remove( df, index, options )

Parameters

df

-

DataFrame

index

-

name, string, integer or list; specifies the index of the column (or columns) to remove from the DataFrame 

Options

• 

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.

Description

• 

The Remove command removes a chosen column or row or a list of columns or rows from a DataFrame.

Examples

The Remove command is used to remove columns from a DataFrame:

dfDataFrame1|2|3,4|5|6,7|8|9

df123112324563789

(1)

The following removes the second column of the DataFrame:

Removedf,2

2

13113246379

(2)

It is also possible to remove multiple columns of a DataFrame:

Removedf,2,3

23

1112437

(3)

It is possible to remove rows in a DataFrame using the mode option:

Removedf,1,mode=row

1

12324563789

(4)

The Remove command does not act inplace. In order to permanently remove a column, reassignment is needed.

dfRemovedf,3

3

df12112245378

(5)

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.

IrisDataImportdatasets/iris.csv,base=datadir

(6)

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.

Statistics:-BoxPlotRemoveIrisData,Species,size=600,golden

5

Compatibility

• 

The DataFrame/Remove command was introduced in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

See Also

select, remove, and selectremove