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

propertyexplanationtypedefault value
namethe name of the data table, derived from the file nameString
fields the name of fields (columns) in the data tableArray
nonNumericFields the name of non-numeric fields (columns) in the data tableArray

Methods

methodexplanationreturn type
getFieldType(f)returns the type of the specified fieldData Type
getFieldSummary(f)returns a summary of the specified fieldObject
getFieldValues(f)returns an array of values for the specified fieldArray
getRowCount()returns the number of rows in the tableNumber
getUniqueFieldValues(f)returns an array of unique values for the specified fieldArray
hasField(f)returns true of the specified field exists in the data tableBoolean
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