DataSeries - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : DataFrames and DataSeries : DataSeries/Constructor

DataSeries

create a DataSeries from data

 Calling Sequence DataSeries( L, opts )

Parameters

 L - : {list,Array,Vector,DataSeries,table} : input data

Options

 • labels : {list,Array,Vector}, labels to use for data items in L
 • datatype : type, the data type for the DataSeries

Description

 • The DataSeries constructor produces, from the input data L, a DataSeries data container with the data in L. If the labels = option is specified, then the data in the resulting DataSeries may be retrieved by using the labels specified, as well as by position, as for an Array or Vector. The input data (L) may be a list, a Vector, an Array, a table, or another DataSeries.
 • If the input L is a table, then the indices of L are used as the labels, while the entries of L are used as the data items.  Note that, in this case, there is no pre-determined order for the data.
 • The input L may be an existing DataSeries, in which case you can use the constructor to produce a new DataSeries with a different (compatible) data type, or to re-label the data items.

Examples

 > $\mathrm{DataSeries}\left(\left[1,2,3\right]\right)$
 $\left[\begin{array}{cc}{1}& {1}\\ {2}& {2}\\ {3}& {3}\end{array}\right]$ (1)
 > $\mathrm{DataSeries}\left(\mathrm{Vector}\left(\left[1,2,3\right]\right)\right)$
 $\left[\begin{array}{cc}{1}& {1}\\ {2}& {2}\\ {3}& {3}\end{array}\right]$ (2)
 > $\mathrm{DataSeries}\left(\mathrm{Array}\left(\left[1,2,3\right]\right)\right)$
 $\left[\begin{array}{cc}{1}& {1}\\ {2}& {2}\\ {3}& {3}\end{array}\right]$ (3)
 > $\mathrm{DataSeries}\left(\left[1,2,3\right],'\mathrm{labels}'=\left['a','b','c'\right]\right)$
 $\left[\begin{array}{cc}{a}& {1}\\ {b}& {2}\\ {c}& {3}\end{array}\right]$ (4)
 > $\mathrm{DataSeries}\left(\left[1,2,3\right],'\mathrm{labels}'=\left["a","b","c"\right]\right)$
 $\left[\begin{array}{cc}{"a"}& {1}\\ {"b"}& {2}\\ {"c"}& {3}\end{array}\right]$ (5)
 > $\mathrm{DataSeries}\left(\left[1,2,3\right],'\mathrm{datatype}'='\mathrm{float}'\left[4\right]\right)$
 $\left[\begin{array}{cc}{1}& {1.}\\ {2}& {2.}\\ {3}& {3.}\end{array}\right]$ (6)
 > $\mathrm{DataSeries}\left(\left[1,2,3\right],'\mathrm{labels}'=\left['a','b','c'\right],'\mathrm{datatype}'='\mathrm{float}'\left[8\right]\right)$
 $\left[\begin{array}{cc}{a}& {1.}\\ {b}& {2.}\\ {c}& {3.}\end{array}\right]$ (7)
 > $\mathrm{ds}≔\mathrm{DataSeries}\left(\mathrm{table}\left(\left['a'=1,'b'=2,'c'=3\right]\right)\right)$
 ${\mathrm{ds}}{≔}\left[\begin{array}{cc}{b}& {2}\\ {c}& {3}\\ {a}& {1}\end{array}\right]$ (8)
 > $\mathrm{DataSeries}\left(\mathrm{ds},'\mathrm{datatype}'='\mathrm{float}'\left[8\right]\right)$
 $\left[\begin{array}{cc}{b}& {2.}\\ {c}& {3.}\\ {a}& {1.}\end{array}\right]$ (9)
 > $\mathrm{DataSeries}\left(\mathrm{ds},'\mathrm{labels}'=\left["X","Y","Z"\right]\right)$
 $\left[\begin{array}{cc}{"X"}& {2}\\ {"Y"}& {3}\\ {"Z"}& {1}\end{array}\right]$ (10)

Compatibility

 • The DataSeries command was introduced in Maple 2016.