DataFrame Conversions - Maple Help

DataFrame/convert

conversions to and from DataFrame

 Calling Sequence convert( expr, DataFrame ) convert( df, typ ) convert( df, list, nested )

Parameters

 expr - a Matrix or two-dimensional Array df - DataFrame

Description

 • The convert command can convert certain types of expressions expr to a DataFrame, and can convert a DataFrame df to certain other types typ.
 • The convert( expr, DataFrame ) form of the command converts an expression expr, which must be a Matrix, or two-dimensional Array, to a DataFrame object.
 • A DataFrame df can be converted to a set, Array, Vector or Matrix, nested list of lists, or table.
 • To convert a DataFrame df to a nested list of lists, use the form convert( df, 'list', 'nested' ).

Examples

 > $\mathrm{df}≔\mathrm{convert}\left(⟨⟨⟨1|2|3⟩,⟨4|5|6⟩⟩⟩,\mathrm{DataFrame}\right)$
 ${\mathrm{df}}{≔}\left[\begin{array}{cccc}{}& {1}& {2}& {3}\\ {1}& {1}& {2}& {3}\\ {2}& {4}& {5}& {6}\end{array}\right]$ (1)
 > $\mathrm{convert}\left(\mathrm{df},'\mathrm{list}','\mathrm{nested}'\right)$
 $\left[\left[{1}{,}{4}\right]{,}\left[{2}{,}{5}\right]{,}\left[{3}{,}{6}\right]\right]$ (2)
 > $\mathrm{convert}\left(\mathrm{df},'\mathrm{table}'\right)$
 ${table}{}\left(\left[\left({2}{,}{1}\right){=}{4}{,}\left({2}{,}{2}\right){=}{5}{,}\left({1}{,}{1}\right){=}{1}{,}\left({1}{,}{2}\right){=}{2}{,}\left({2}{,}{3}\right){=}{6}{,}\left({1}{,}{3}\right){=}{3}\right]\right)$ (3)
 > $\mathrm{convert}\left(\mathrm{df},'\mathrm{Matrix}'\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {3}\\ {4}& {5}& {6}\end{array}\right]$ (4)

Compatibility

 • The DataFrame/convert command was introduced in Maple 2016.