DataTable
The DataTable class represents a data table consisting of tuples (rows) and fields (columns). DataTable objects are created by importing Comma Separated Values (CSV) files using the csv function:
let table = await msc.csv("data.csv");
Mascot automatically infers the data type for each field/column, and parses the values accordingly
Properties
property | explanation | type | default value |
---|---|---|---|
name | the name of the data table, derived from the file name | String | |
fields | the name of fields (columns) in the data table | Array | |
nonNumericFields | the name of non-numeric fields (columns) in the data table | Array |
Methods
method | explanation | return type |
---|---|---|
getFieldType(f) | returns the type of the specified field | Data Type |
getFieldSummary(f) | returns a summary of the specified field | Object |
getFieldValues(f) | returns an array of values for the specified field | Array |
getRowCount() | returns the number of rows in the table | Number |
getUniqueFieldValues(f) | returns an array of unique values for the specified field | Array |
hasField(f) | returns true of the specified field exists in the data table | Boolean |
transform(type, fields, paramas) | returns a new data table as a result of specified transformation type (String): type of transformation fields (Array): array of fields to be transformed params (Object): parameters for the transformation e.g., let table2 = table.transform('kde', ['col1'], {min: 3, interval: 0.1, max: 8, bandwidth: 0.25}) | DataTable |