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

Tabulate

insert a DataFrame as a worksheet Table

 Calling Sequence Tabulate(df, opts)

Parameters

 df - a DataFrame object opts - options for the DocumentTools[Tabulate] command, as described on that help page

Description

 • The Tabulate command, applied to a DataFrame object, inserts the DataFrame as a worksheet Table into the worksheet.
 • The column labels are shown in a row inserted before the rows of actual data in the DataFrame. Similarly, the row labels are shown in a column inserted before the columns of data. By default, they are shown with a different background color than the other values.
 • The options for this command are discussed on the help page DocumentTools[Tabulate]. They include options for changing the foreground and background color for the cells, showing table borders, as well as options to control the width of the table and of the individual columns.
 • The return value of the command is the identity of the inserted parent Table, as a string. The display of the returned value can be suppressed by terminating the statement with a full colon.
 • This command inserts the assembly of Tables and Embedded Components into the worksheet using the InsertContent facility. The inserted content is placed after any usual output of the Execution Group in which this command is called. Each Execution Group allows for only one inserted result to exist at any given time. Multiple calls to commands which utilize the InsertContent facility made within the same Execution Group will result in each successive inserted assembly replacing any assembly inserted earlier for that Execution Group.

Examples

A basic example follows:

 > $\mathrm{df}≔\mathrm{DataFrame}\left(⟨⟨1,2⟩|⟨3,4⟩|⟨5,6⟩⟩,\mathrm{columns}=\left[a,b,c\right],\mathrm{rows}=\left[d,e\right]\right)$
 ${\mathrm{DataFrame}}{}\left(\left[\begin{array}{rrr}1& 3& 5\\ 2& 4& 6\end{array}\right]{,}{\mathrm{rows}}{=}\left[{d}{,}{e}\right]{,}{\mathrm{columns}}{=}\left[{a}{,}{b}{,}{c}\right]\right)$ (1)
 > $\mathrm{Tabulate}\left(\mathrm{df}\right):$

 a b c d $1$ $3$ $5$ e $2$ $4$ $6$

If we want to specify the relative width of the columns, we can do that by specifying the weights option, which specifies relative weights for the widths of the table columns.  Note that, while the DataFrame has three columns, the Table has four: there is an extra column for the row labels. Thus, we specify four weights. We also use the width option to specify that the total width of the table should be 50% of the width of the worksheet.

 > $\mathrm{Tabulate}\left(\mathrm{df},\mathrm{weights}=\left[1,2,2,2\right],\mathrm{width}=50.\right):$

 a b c d $1$ $3$ $5$ e $2$ $4$ $6$

The returned identity of the Table can be used to modify Table properties following insertion.

 > $\mathrm{id}≔\mathrm{Tabulate}\left(\mathrm{df},\mathrm{weights}=\left[1,2,2,2\right],\mathrm{width}=50.\right):$

 a b c d $1$ $3$ $5$ e $2$ $4$ $6$

 > $\mathrm{id}$
 ${"Tabulate1"}$ (2)
 > $\mathrm{DocumentTools}:-\mathrm{SetProperty}\left(\mathrm{id},{'\mathrm{fillcolor}'}_{2..\left(\right),2..\left(\right)},"LightGreen"\right)$

Compatibility

 • The Tabulate command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.