DataFrame - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Overview of DataFrames

 

Description

Indexing

Description

• 

A DataFrame is a two-dimensional data container, similar to a Matrix, but which can contain heterogeneous data, and for which symbolic names may be associated with the rows and columns. The column labels need to be unique, as do the row labels.

Indexing

• 

Each column of a DataFrame is a DataSeries, and the column labels may be used to refer to the corresponding column.

df := DataFrame( < 1, 2, 3; 4, 5, 6 >, 'rows' = [ 'a', 'b' ], 'columns' = [ 'A', 'B', 'C' ] );

dfABCa123b456

(1)

type( df[ 'B' ], DataSeries );

true

(2)
• 

Since each column is a DataSeries, you can index hierarchically into the columns of a DataFrame to extract individual data elements.

df[ 'B' ][ 1 ];

2

(3)

df[ 'B' ][ 'b' ];

5

(4)
• 

However, you can also select individual data items by specifying the desired row and column indices directly.  (Row and column indices may be either numeric, by position, or symbolic.)

df[ 1, 2 ];

2

(5)

df[ 'a', 'B' ];

2

(6)
• 

You can use a range or list to select specified columns. In the case of a list, they can come in any desired order.

df[ 'A' .. 'B'];

ABa12b45

(7)

df[ [ 'B', 'C', 'A' ] ];

BCAa231b564

(8)
• 

For more information on indexing a DataFrame, see DataFrame,indexing.

Applications

Statistics with DataFrames

Subsets of DataFrames

See Also

A Guide to Data Frames

DataFrame/Constructor

DataFrame/indexing

DataSeries