breadroll icon indicating copy to clipboard operation
breadroll copied to clipboard

Feature request: strongly typed dataframes

Open itsyoboieltr opened this issue 5 months ago • 3 comments

The big advantage of using this over python would be speed, and also that it could be made completely type-safe. If the user knows the rows/columns ahead of time (which is most likely the case) I would suggest we add the possibility to pass a type parameter.

import Breadroll, { Dataframe } from 'breadroll';

interface Row {
  name: string;
  age: number;
  city: string;
}

const csv: Breadroll = new Breadroll({ header: true, delimiter: ',' });

const df: Dataframe<Row> = await csv.open.local<Row>('./data/input.csv');

This would ideally make all functions completely type-safe: you should not be able to access columns that do not exist, you have autocomplete for filtering, etc.

itsyoboieltr avatar Mar 03 '24 16:03 itsyoboieltr