DataFrame
create a DataFrame from data
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
DataFrame( L, opts )
DataFrame( ds1, ds2, ..., opts );
DataFrame( label1 = ds1, label2 = ds2, ..., opts );
DataFrame( T, opts );
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
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
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.
DataFrame⁡1|2|3,4|5|6
12311232456
df ≔ DataFrame⁡1|2|3,4|5|6,'rows'='a','b','columns'='A','B','C'
df≔ABCa123b456
df'A'
a1b4
type⁡df'A',DataSeries
true
DataFrame⁡1|2|3,4|5|6,'rows'='a','b','columns'='A','B','C','datatypes'='integer'4,'integer'4,'integer'2
ABCa123b456
DataFrame⁡1,2,3,4,5,6
12114225336
12311352246
The numbers of elements in each column must be the same.
DataFrame⁡1,2,3,4,5
Error, (in DataFrame:-ModuleCopy) every column must have equally many data points, but received {2, 3}
DataFrame⁡df,'rows'='c','d'
ABCc123d456
DataFrame⁡df,'columns'='First','Second','Third'
FirstSecondThirda123b456
DataFrame⁡df,'rows'='above','below','columns'='First','Second','Third'
FirstSecondThirdabove123below456
ds1 ≔ DataSeries⁡1,2,3
ds1≔112233
ds2 ≔ DataSeries⁡4,5,6
ds2≔142536
DataFrame⁡ds1,ds2
DataFrame⁡ds1,ds2,'columns'='A','B'
AB114225336
The DataFrame command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
DataSeries,Constructor
type,listlist
type,table
Download Help Document
What kind of issue would you like to report? (Optional)