verify/dataframe - Maple Help

verify/dataframe

verify a relation between two DataFrame objects

 Calling Sequence verify(expr1, expr2, dataframe) verify(expr1, expr2, dataframe(ver, opt)

Parameters

 expr1, expr2 - anything ver - (optional) verification to use for the entries of the DataFrame objects opt - (optional) equation(s) of the form labelverification = lver or columnlabelverification = cver or rowlabelverification = rver, where lver, cver, and rver are verifications

Description

 • The verify(expr1, expr2, dataframe) command returns true if expr1 and expr2 are both DataFrame objects, and their labels and entries are the same and occur in the same order.
 • The verify(expr1, expr2, dataframe(ver)) command returns true if expr1 and expr2 are both DataFrame objects, and their labels are the same and occur in the same order, and each entry of expr1 is in the relation specified by ver with the corresponding entry of expr2.
 • The verify(expr1, expr2, dataframe(columnlabelverification=cver)) command returns true if expr1 and expr2 are both DataFrame objects, and their entries and row labels are the same and occur in the same order, and each column label of expr1 is in the relation specified by cver with the corresponding column label of expr2. Similar if the rowlabelverification = rver is specified. If labelverification = lver is specified, then lver is used for both row and column labels. The rowlabelverification and columnlabelverification options override labelverification if more than one is specified.
 • The verify(expr1, expr2, dataframe(ver, labelverification=lver)) command returns true if expr1 and expr2 are both DataFrame objects, and each label of expr1 is in the relation specified by lver with the corresponding label of expr2, and each entry of expr1 is in the relation specified by ver with the corresponding entry of expr2. This generalizes in the obvious way if columnlabelverification and/or rowlabelverification are specified.
 • The relation specified as dataframe(...) is symmetric if all verifications given as options are symmetric. This is vacuously the case if no optional arguments are included.

Examples

 > $\mathrm{df1}≔\mathrm{DataFrame}\left(\left[\left[1.,2.\right],\left[3.,4.\right]\right],\mathrm{columns}=\left[A,B\right],\mathrm{rows}=\left[a,b\right]\right)$
 ${\mathrm{df1}}{≔}\left[\begin{array}{ccc}{}& {A}& {B}\\ {a}& {1.}& {3.}\\ {b}& {2.}& {4.}\end{array}\right]$ (1)
 > $\mathrm{df2}≔\mathrm{DataFrame}\left(\left[\left[1.01,2.\right],\left[3.01,3.99\right]\right],\mathrm{columns}=\left[A,B\right],\mathrm{rows}=\left[a,b\right]\right)$
 ${\mathrm{df2}}{≔}\left[\begin{array}{ccc}{}& {A}& {B}\\ {a}& {1.01}& {3.01}\\ {b}& {2.}& {3.99}\end{array}\right]$ (2)
 > $\mathrm{df3}≔\mathrm{DataFrame}\left(\left[\left[3.,4.\right],\left[1.,2.\right]\right],\mathrm{columns}=\left[A,B\right],\mathrm{rows}=\left[b,a\right]\right)$
 ${\mathrm{df3}}{≔}\left[\begin{array}{ccc}{}& {A}& {B}\\ {b}& {3.}& {1.}\\ {a}& {4.}& {2.}\end{array}\right]$ (3)
 > $\mathrm{df4}≔\mathrm{DataFrame}\left(\left[\left[1.,2.\right],\left[3.,4.\right]\right],\mathrm{columns}=\left[C,\mathrm{D}\right],\mathrm{rows}=\left[a,b\right]\right)$
 ${\mathrm{df4}}{≔}\left[\begin{array}{ccc}{}& {C}& {\mathrm{D}}\\ {a}& {1.}& {3.}\\ {b}& {2.}& {4.}\end{array}\right]$ (4)

df1 and df1 have the same entries and labels.

 > $\mathrm{verify}\left(\mathrm{df1},\mathrm{df1},\mathrm{dataframe}\right)$
 ${\mathrm{true}}$ (5)

df1 and df2 have different entries.

 > $\mathrm{verify}\left(\mathrm{df1},\mathrm{df2},\mathrm{dataframe}\right)$
 ${\mathrm{false}}$ (6)

However, they are pairwise in the relation float(2, digits=3) (see verify/float).

 > $\mathrm{verify}\left(\mathrm{df1},\mathrm{df2},\mathrm{dataframe}\left(\mathrm{float}\left(2,\mathrm{digits}=3\right)\right)\right)$
 ${\mathrm{true}}$ (7)

While df1 and df3 map the same labels to the same values, they are ordered differently (in particular, the rows are swapped). The verify/dataframe command has no facility to recognize this.

 > $\mathrm{verify}\left(\mathrm{df1},\mathrm{df3},\mathrm{dataframe}\right)$
 ${\mathrm{false}}$ (8)

df1 and df4 have the same entries, but different column labels. We specify columnlabelverification = true (see verify/true) so that the labels compare pairwise successfully.

 > $\mathrm{verify}\left(\mathrm{df1},\mathrm{df4},\mathrm{dataframe}\left(\mathrm{columnlabelverification}=\mathrm{true}\right)\right)$
 ${\mathrm{true}}$ (9)