map<T, R> abstract method

DataFrame map<T, R>(
  1. R mapper(
    1. T value
    )
)

Returns a new DataFrame with modified data according to the mapper function

T is a type of the source value, R is a type of the mapped value. If the value's type won't be changed, one needs to provide the same types for both generic types.

Usage example:

import 'package:ml_dataframe/ml_dataframe';

void main() {
  final data = DataFrame([
    ['col_1', 'col_2', 'col_3'],
    [      2,      20,     200],
    [      3,      30,     300],
    [      4,      40,     400],
  ]);
  final modifiedData = data.map<num, num>((value) => value * 2);

  print(modifiedData);
  // DataFrame (3 x 3)
  // col_1 col_2 col_3
  //     4    40   400
  //     6    60   600
  //     8    80   800
}

Implementation

DataFrame map<T, R>(R Function(T value) mapper);