Overview of DataFrames
Description
Indexing
A DataFrame is a two-dimensional data container, similar to a Matrix, but which can contain heterogeneous data, and for which symbolic names may be associated with the rows and columns.
Each column of a DataFrame is a DataSeries, and the column labels may be used to refer to the corresponding column.
df := DataFrame( < 1, 2, 3; 4, 5, 6 >, 'rows' = [ 'a', 'b' ], 'columns' = [ 'A', 'B', 'C' ] );
df≔ABCa123b456
type( df[ 'B' ], DataSeries );
true
Since each column is a DataSeries, you can index hierarchically into the columns of a DataFrame to extract individual data elements.
df[ 'B' ][ 1 ];
2
df[ 'B' ][ 'b' ];
5
However, you can also select individual data items by specifying the desired row and column indices directly. (Row and column indices may be either numeric, by position, or symbolic.)
df[ 1, 2 ];
df[ 'a', 'B' ];
You can use a range or list to select specified columns. In the case of a list, they can come in any desired order.
df[ 'A' .. 'B'];
ABa12b45
df[ [ 'B', 'C', 'A' ] ];
BCAa231b564
For more information on indexing a DataFrame, see DataFrame,indexing.
Applications
Statistics with DataFrames
Subsets of DataFrames
See Also
A Guide to Data Frames
DataFrame/Constructor
DataFrame/indexing
DataSeries
Download Help Document
What kind of issue would you like to report? (Optional)