Overview of DataSeries
Description
Indexing
Examples
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 >~ 4;
ds[ ds >~ 4 ];
Hourly temperatures reported by the BlackBerry Weather App for Waterloo, Ontario on October 27/28 2015.
Compute the average temperature over this 24-hour period.
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:
See Also
DataFrame
DataSeries/Constructor
Download Help Document