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

Online Help

All Products    Maple    MapleSim


DataFrame

create a DataFrame from data

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

DataFrame( L, opts )

DataFrame( ds1, ds2, ..., opts );

DataFrame( label1 = ds1, label2 = ds2, ..., opts );

DataFrame( T, opts );

Parameters

L

-

: {listlist,list(DataSeries),Array,Matrix,DataFrame,table} : input data

ds1, ds2, ...

-

: DataSeries : columns from existing DataSeries

label1, label2, ...

-

column labels to use

T

-

: table : data specification in table form

Options

• 

rows : {list,Array,Vector}, labels to use for the rows of data

• 

columns : {list,Array,Vector}, labels to use for the columns of data

• 

datatypes : list(type), types for the columns of data

Description

• 

The DataFrame constructor produces a DataFrame data container, from the input data in various forms.

• 

The input data (L) may be a list of columns for the resulting DataFrame. The individual columns in L may be specified as lists, one-dimensional rtables (Arrays, Vectors), or DataSeries objects.

• 

You can also specify the data as a two-dimensional rtable (Matrix or Array) L, in which case the rows and columns of L are used respectively as the rows and columns of data for the DataFrame.

• 

A sequence ds1, ds2, ... of DataSeries objects may be passed, and these are used as the columns of the resulting DataFrame.

• 

A sequence of equations of the form label = ds can be passed to simultaneously specify the columns of data, from the DataSeries ds, and corresponding column labels label.

• 

If the input T is a table, then the indices of T are used as the column labels, while the entries of T are used as the data items for the corresponding columns. Note that in this case, there is no pre-determined order for the columns.

• 

The input L may be an existing DataFrame, in which case you can use the constructor to produce a new DataFrame with different (compatible) data types, or to re-label the data items.

Examples

DataFrame1|2|3,4|5|6

12311232456

(1)

dfDataFrame1|2|3,4|5|6,rows=a,b,columns=A,B,C

dfABCa123b456

(2)

dfA

a1b4

(3)

typedfA,DataSeries

true

(4)

DataFrame1|2|3,4|5|6,rows=a,b,columns=A,B,C,datatypes=integer4,integer4,integer2

ABCa123b456

(5)

DataFrame1,2,3,4,5,6

12114225336

(6)

DataFrame1,2,3,4,5,6

12311352246

(7)

The numbers of elements in each column must be the same.

DataFrame1,2,3,4,5

Error, (in DataFrame:-ModuleCopy) every column must have equally many data points, but received {2, 3}

DataFramedf,rows=c,d

ABCc123d456

(8)

DataFramedf,columns=First,Second,Third

FirstSecondThirda123b456

(9)

DataFramedf,rows=above,below,columns=First,Second,Third

FirstSecondThirdabove123below456

(10)

ds1DataSeries1,2,3

ds1112233

(11)

ds2DataSeries4,5,6

ds2142536

(12)

DataFrameds1,ds2

12114225336

(13)

DataFrameds1,ds2

12114225336

(14)

DataFrameds1,ds2,columns=A,B

AB114225336

(15)

Compatibility

• 

The DataFrame command was introduced in Maple 2016.

• 

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

See Also

DataFrame

DataSeries,Constructor

type,listlist

type,table