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

Online Help

All Products    Maple    MapleSim


DataFrame/Append

append a DataFrame or DataSeries to a DataFrame

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Append( df1, df2, opts )

Parameters

df1

-

: a DataFrame object

df2

-

: a DataFrame or DataSeries object, a list, or a Vector

opts

-

: (optional) an option of the form mode = m, where m is one of row or rows or column or columns or merge or overwrite, and/or an option of the form label = L

Description

• 

The Append( df1, df2 ) command appends the DataFrame or DataSeries object df2 to the DataFrame df1, and returns the newly constructed DataFrame. It does not modify df1.

• 

By specifying the option mode=row or mode=rows (the two are equivalent), you instruct the Append command to append df2 as new rows. In this mode, if df2 is a DataFrame, df1 and df2 must have disjoint row labels. Column labels may be shared, and common columns will be aligned. If df2 is a DataSeries, then its labels will be aligned with the column labels of df1. If df2 is a list or a Vector, then its entries will form the new row in the same order as in df2 itself.

  

This mode is the default if df2 is a DataFrame.

• 

By specifying the option mode=column or mode=columns (the two are equivalent), the Append command is made to work in column mode. In this mode, if df2 is a DataFrame, then df1 and df2 must have disjoint column labels, and row labels will be aligned. If df2 is a DataSeries object, it will be added as a new column, and its labels will be aligned with the row labels of df1. If df2 is a list or a Vector, then its entries will form the new column in the same order as in df2 itself.

  

This mode is the default if df2 is a DataSeries, a list, or a Vector.

• 

By specifying the option mode=merge or mode=overwrite, you select a mode that allows for overlap between both row and column labels. With mode=merge, those values will come from df1; by specifying mode=overwrite, they come from df2. (In the case of mode=overwrite, the order of labels in the result will be based on the order in df2; this is different from all other modes, where it is based on the order in df1.) These modes can only be used if df2 is a DataFrame object.

• 

If df2 is a DataSeries, then the label for the new row (in row mode) or column (in column mode) is, by default, an arbitrary positive integer. If the label option is specified, its value is used instead.

  

If df2 is a list or a Vector, then the same rules apply. Also, the number of entries of df2 must be the same as the number of rows (in column mode) or columns (in row mode) of df1.

Examples

df1DataFrame1|2|3,4|5|6,7|8|9,columns=A,B,C,rows=a,b,c

df1ABCa123b456c789

(1)

df2DataFrame12|23|34,45|56|67,78|89|910,columns=B,C,D,rows=d,e,f

df2BCDd122334e455667f7889910

(2)

Appenddf1,df2

ABCDa123undefinedb456undefinedc789undefineddundefined122334eundefined455667fundefined7889910

(3)

Compatibility

• 

The DataFrame/Append command was introduced in Maple 2016.

• 

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

See Also

DataFrame

DataSeries,Append