Datatype - Maple Help

DataSeries/Datatype

obtain the data type of a DataSeries

 Calling Sequence Datatype(ds)

Parameters

 ds - a DataSeries object

Description

 • The Datatype command returns the data type of a DataSeries object.
 • The data type determines the values that can be stored in the data series. This is similar to the datatype option of an rtable.
 • Trying to set an entry of a DataSeries to a value that is not of the specified data type leads to an error.
 • The data type can be set using the datatype option in the DataSeries constructor call.
 • If no data type is specified in the constructor call, Maple uses the data type of the data argument if that is an rtable or DataSeries, or type anything otherwise.
 • If you want to store floating point data in a DataSeries, it will be advantageous to set the data type to float[8]. This uses less memory than the alternatives, and it can yield speed-ups in computations.
 • If you want to store true-or-false data in a DataSeries, it will be advantageous to set the data type to truefalse or truefalseFAIL. (FAIL is the third Boolean constant in Maple, signifying unknown or undetermined truth values.) This yields small speed-ups when used in DataSeries indexing or DataFrame indexing.

Examples

The default data type is anything.

 > $\mathrm{ds1}≔\mathrm{DataSeries}\left(\left[1,2,3\right]\right)$
 ${\mathrm{ds1}}{≔}\left[\begin{array}{cc}{1}& {1}\\ {2}& {2}\\ {3}& {3}\end{array}\right]$ (1)
 > $\mathrm{Datatype}\left(\mathrm{ds1}\right)$
 ${\mathrm{anything}}$ (2)
 > $\mathrm{v1}≔\mathrm{Vector}\left(\left[2.,3.\right]\right)$
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{2.}\\ {3.}\end{array}\right]$ (3)
 > $\mathrm{ds2}≔\mathrm{DataSeries}\left(\mathrm{v1}\right)$
 ${\mathrm{ds2}}{≔}\left[\begin{array}{cc}{1}& {2.}\\ {2}& {3.}\end{array}\right]$ (4)
 > $\mathrm{Datatype}\left(\mathrm{ds2}\right)$
 ${\mathrm{anything}}$ (5)

You can override the default in the DataSeries constructor.

 > $\mathrm{ds3}≔\mathrm{DataSeries}\left(\mathrm{v1},\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{ds3}}{≔}\left[\begin{array}{cc}{1}& {2.}\\ {2}& {3.}\end{array}\right]$ (6)
 > $\mathrm{Datatype}\left(\mathrm{ds3}\right)$
 ${{\mathrm{float}}}_{{8}}$ (7)

Alternatively, you can make sure that the data defining the DataSeries already has a specified data type.

 > $\mathrm{v2}≔\mathrm{Vector}\left(\left[2.,3.\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{2.}\\ {3.}\end{array}\right]$ (8)
 > $\mathrm{ds4}≔\mathrm{DataSeries}\left(\mathrm{v2}\right)$
 ${\mathrm{ds4}}{≔}\left[\begin{array}{cc}{1}& {2.}\\ {2}& {3.}\end{array}\right]$ (9)
 > $\mathrm{Datatype}\left(\mathrm{ds4}\right)$
 ${{\mathrm{float}}}_{{8}}$ (10)

Compatibility

 • The DataSeries/Datatype command was introduced in Maple 2016.