addColumn method

void addColumn(
  1. String name,
  2. RecordCol records
)

Add a new column to the end of the dataframe. The records have to be of the same length as the dataframe.

Implementation

void addColumn(String name, RecordCol records) {
  if (_trackedColumnNames.contains(name)) {
    throw ArgumentError('$name column does already exist');
  }

  try {
    records.asMap().forEach((index, row) {
      this[index].add(row);
    });
  } on ArgumentError catch (_) {
    throw ArgumentError(
        'Length of column records does not match the one of the data frame');
  }

  _trackedColumnNames.add(name);
}