Datacat class

A versatile data structure resembling a DataFrame. It holds column names and rows of data, and it can enforce a schema.

Constructors

Datacat({required List<String> columns, required List<List> rows})
Datacat.fromJsonMapString(String jsonString)
Creates nested Datacats from a JSON string representing a map where each key maps to a list of objects.
factory
Datacat.fromJsonString(String jsonString)
Creates a Datacat from a JSON string representing a list of objects.
factory
Datacat.withSchema({required DatacatSchema schema, required List<List> rows})
Creates a Datacat that enforces the provided schema. The columns will be set to the keys in the schema. Throws an error if the provided rows do not conform to the schema.

Properties

columns List<String>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
rows List<List>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addRow(List row) → void
Adds a new row and verifies it against the schema if defined.
describe() Map<String, Map<String, num>>
Computes summary statistics for numeric columns. Returns a map with each numeric column mapped to count, sum, mean, min, and max.
dropColumns(List<String> dropColumns) Datacat
Returns a new Datacat with the specified columns dropped.
fillNA(String columnName, dynamic fillValue) Datacat
Fills missing (null) values in the specified column with fillValue.
groupBy(String columnName) Map<dynamic, Datacat>
Groups rows by the given column and returns a Map from key to Datacat.
Returns a new Datacat with the first n rows.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
selectColumns(List<String> selectedColumns) Datacat
Returns a new Datacat with only the selected columns.
sortBy(String columnName, {bool ascending = true}) Datacat
Returns a new Datacat sorted by the given column.
tail([int n = 5]) Datacat
Returns a new Datacat with the last n rows.
toString() String
A string representation of this object.
override
updateCell(int rowIndex, String columnName, dynamic newValue) → void
Updates a cell at rowIndex in column columnName with newValue, then checks the schema.

Operators

operator ==(Object other) bool
The equality operator.
inherited