convert - Maple Help

DataSets[Quandl][Reference]

 convert
 convert a reference to another data type

 Calling Sequence convert(ref, conversion, extra)

Parameters

 ref - Quandl reference object conversion - name; what to convert the data set to extra - (optional) extra arguments for the conversion

Description

 • The convert command can convert to a TimeSeries, DataFrame, an Array, a Matrix, or a listlist (a list of lists). If the data has only a single column, then it can also convert to a Vector (or a Vector[row] (a row vector)), or a list (a single, flat list).
 • The conversion to TimeSeries accepts any number of extra arguments which are passed to the TimeSeries constructor call. You can use this to, for example, override the column names, by passing an argument of the form headers = my_headers, or to set the period if you expect a particular periodicity by passing an argument of the form period = n.
 • The conversions to Array, Matrix, and Vector accept any number of extra arguments which are passed to the appropriate data structure constructor. You can use this to, for example, set the datatype of the new data structure by passing a datatype = d option.

Examples

 > $\mathrm{with}\left(\mathrm{DataSets}\right):$

We create a reference by identifier.

 > $\mathrm{ref}≔\mathrm{Quandl}:-\mathrm{Reference}\left("FRED/CANPOPL"\right)$
 ${\mathrm{ref}}{≔}\left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{Population in Canada \left(DISCONTINUED\right)}}\\ {\mathrm{Quandl FRED/CANPOPL}}\\ {\mathrm{up to 52 rows \left(annual\right), 1 column}}\\ {\mathrm{1960-01-01 - 2011-01-01}}\end{array}\right]$ (1)

The data in this data set as a Matrix:

 > $\mathrm{convert}\left(\mathrm{ref},'\mathrm{Matrix}'\right)$
 $\begin{array}{c}\left[\begin{array}{cc}{"1960-12-31"}& {17.91}\\ {"1961-12-31"}& {18.27}\\ {"1962-12-31"}& {18.61}\\ {"1963-12-31"}& {18.96}\\ {"1964-12-31"}& {19.33}\\ {"1965-12-31"}& {19.68}\\ {"1966-12-31"}& {20.05}\\ {"1967-12-31"}& {20.41}\\ {"1968-12-31"}& {20.73}\\ {"1969-12-31"}& {21.03}\\ {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{52 × 2 Matrix}}\end{array}$ (2)

We convert the data set to a TimeSeries and set the period to 3.

 > $\mathrm{convert}\left(\mathrm{ref},'\mathrm{TimeSeries}','\mathrm{period}'=3\right)$
 $\left[\begin{array}{c}{\mathrm{Time series}}\\ {\mathrm{VALUE}}\\ {\mathrm{52 rows of data:}}\\ {\mathrm{1960-12-31 - 2011-12-31}}\end{array}\right]$ (3)
 > $\mathrm{ref2}≔\mathrm{DataSets}:-\mathrm{Reference}\left("quandl","PORDATA/01"\right)$
 ${\mathrm{ref2}}{≔}\left[\begin{array}{c}{\mathrm{Data set}}\\ {\mathrm{Portugal Population, Population Census, Resident population by sex}}\\ {\mathrm{Quandl PORDATA/01}}\\ {\mathrm{up to 52 rows \left(annual\right), 3 columns}}\\ {\mathrm{1960-12-31 - 2011-12-31}}\end{array}\right]$ (4)

The data in this second data reference as a DataFrame:

 > $\mathrm{convert}\left(\mathrm{ref2},\mathrm{DataFrame}\right)$
 $\left[\begin{array}{cccc}{}& {"Total"}& {"Males"}& {"Females"}\\ {"1960-12-31"}& {8.8893920}{×}{{10}}^{{6}}& {4.2544160}{×}{{10}}^{{6}}& {4.6349760}{×}{{10}}^{{6}}\\ {"1970-12-31"}& {8.6632520}{×}{{10}}^{{6}}& {4.1093600}{×}{{10}}^{{6}}& {4.5538920}{×}{{10}}^{{6}}\\ {"1981-12-31"}& {9.8330140}{×}{{10}}^{{6}}& {4.7377150}{×}{{10}}^{{6}}& {5.0952990}{×}{{10}}^{{6}}\\ {"1991-12-31"}& {9.8671470}{×}{{10}}^{{6}}& {4.7567750}{×}{{10}}^{{6}}& {5.1103720}{×}{{10}}^{{6}}\\ {"2001-12-31"}& {1.03561170}{×}{{10}}^{{7}}& {5.0001410}{×}{{10}}^{{6}}& {5.3559760}{×}{{10}}^{{6}}\\ {"2011-12-31"}& {1.05621780}{×}{{10}}^{{7}}& {5.0466000}{×}{{10}}^{{6}}& {5.5155780}{×}{{10}}^{{6}}\end{array}\right]$ (5)

Compatibility

 • The DataSets[Quandl][Reference][convert] command was introduced in Maple 2015.