Overview of DataSeries
A DataSeries is a one-dimensional data container, similar to a one-dimensional Array, but whose entries can be referenced by "labels", as well as by position.
A related two-dimensional data container, known as a DataFrame is also available.
You can access the elements of a DataSeries similar to the way in which you access Array elements, by indexing the DataSeries by position. If ds is a DataSeries, then ds[ i ] evaluates to the ith element of ds. However, the elements of a DataSeries are also associated with symbolic names, and you can use these names to refer to DataSeries elements as well.
ds := DataSeries( [ sin( x ), cos( x ), tan( x ) ], 'labels' = [ 's', 'c', 't' ] );
ds[ 2 ];
ds[ 'c' ];
To select a range of entries in a DataSeries, returning the result as a DataSeries, use a range of indices or labels.
ds[ 1 .. 2 ];
ds[ 'c' .. 't' ];
Note that indices and labels can be used together:
ds[ 'c' .. -1 ];
You can select non-contiguous entries by enclosing the desired indices in a list.
ds[ [ 's', 't' ] ];
One particular application for this kind of index is to re-order the given DataSeries.
ds2 := ds[ [ 2, 3, 1 ] ];
ds ≔ DataSeries⁡4,5,6,'labels'='a','b','c'
ds >~ 4;
ds[ ds >~ 4 ];
Hourly temperatures reported by the BlackBerry Weather App for Waterloo, Ontario on October 27/28 2015.
oct27_28 ≔ DataSeries⁡map⁡Temperature,11,12,13,12,11,10,9,8,7,7,7,7,7,7,7,7,7,8,8,8,7,8,9,10,'degC','labels'=12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00,00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00
Compute the average temperature over this 24-hour period.
avg ≔ add⁡oct27_28numelems⁡oct27_28
DataSeries objects can be converted to an Array, Vector, Matrix, table, list, or set:
Converting a DataSeries to a set only shows the unique elements:
Converting to a table is the only conversion that attempts to maintain information on labels:
Download Help Document