A poor man's version of a pandas DataFrame for dart.

Overview

koala

Build codecov GitHub

A poor man's version of a pandas DataFrame.
Collect, access & manipulate related data.

Examples

Create a DataFrame from a csv file, preexisting column names and data, map representations of the data or create an empty DataFrame and provide it with its properties later on

final fromCsv = Dataframe.fromCsv(
    path: 'path/to/file.csv', 
    eolToken: '\n', 
    maxRows: 40,
    skipColumns: ['date'],
    convertDates: true,
    datePattern: 'dd-MM-yyyy'
);

final fromNamesAndData = DataFrame.fromNamesAndData(
    ['a', 'b'], 
    [
      [1, 2],
      [3, 4],
      [69, 420]
    ]
);

The DataFrame class inherits from the list which contains its data matrix, so rows may be accessed through normal indexing. Columns on the other hand can be accessed by calling the instance with a contained column name.

// get a row
final secondRow = df[1];

// get a column
final bColumn = df('b');
final typedBColumn = df<double?>('b');
final slicedBColumn = df('b', start: 1, end: 5);
final filteredBColumn = df('b', includeRecord: (el) => el > 7);

// grab a singular record
final record = df.record<int>(3, 'b');

Manipulate rows & column

// add and remove rows through the built-in list methods 
df.add([2, 5]);
df.removeAt(4);
df.removeLast();

// manipulate columns
df.addColumn('newColumn', [4, 8, 2]);
df.removeColumn('newColumn');
df.transformColumn('a', (record) => record * 2);

Copy or slice the DataFrame

final copy = df.copy();
final sliced = df.sliced(30, 60);   
df.slice(10, 15);  // in-place counterpart

Sort the DataFrame in-place or get a sorted copy of it

final sorted = df.sortedBy('a', ascending: true, nullFirst: false);
sorted.sortBy('b', ascending: false, compareRecords: (a, b) => Comparable.compare(a.toString().length, b.toString().length));

Obtain a readable representation of the DataFrame by simply passing it to the print function

DataFrame df = DataFrame.fromRowMaps([
  {'col1': 1, 'col2': 2},
  {'col1': 1, 'col2': 1},
  {'col1': null, 'col2': 8},
]);
print(df);

leads to the output:

    col1 col2
0 | 1    2   
1 | 1    1   
2 | null 8   

...and so on and so forth.

Contribution

I intend to actively maintain this repo, so feel free to create PRs, as there still is a hell of a lot of functionality one may add to the DataFrame.

Acknowledgements

This repository started off as a fork from the as of now unmaintained and generally lackluster df, ultimately however, I wound up rewriting basically everything. Still, shout out boyz.

Author

C'est moi, w2sv

You might also like...

A Flutter widget that checks and displays the version status of application and you can easily guide user to update your app

A Flutter widget that checks and displays the version status of application and you can easily guide user to update your app

A most easily usable Flutter widget about application version check! 1. About 1.

Dec 16, 2021

Mobile version of web todoie app.

flutter_todoie Todoie App Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is yo

Dec 26, 2021

A flutter plugin to get android version(SDK INT).

get_sdk_int A new flutter plugin project. Getting Started This project is a starting point for a Flutter plug-in package, a specialized package that i

Dec 28, 2021

A demo version of POS project.

pos_simplified A demo version of POS project. Getting Started This project is a starting point for a Flutter application. A few resources to get you s

Dec 28, 2021

Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.

Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.

Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips. What's New in Version 2.x.x Added p

Sep 20, 2022

Flutter-watchtips - Flutter App (Embedded Watch Kit app with iOS version)

Flutter-watchtips - Flutter App  (Embedded Watch Kit app with iOS version)

watchtips Update Version 2.2 The Watch tips project has been updated again, The interface has been tidied up and a seperate value for the tip cost has

Sep 4, 2022

MPAndroidChart Flutter version

MPAndroidChart Flutter version

MPFlutterChart flutter charts just like MPAndroidChart The minimum version currently supported is 1.7.3. If you use flutter with lower version, checko

Sep 24, 2022

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Upgrader Flutter package for prompting users to upgrade when there is a newer version of the app in the store. When a newer app version is availabe in

Sep 23, 2022

A modified version of the existing checkbox with the shape of a circle instead of a rounded rectangle!

A modified version of the existing checkbox with the shape of a circle instead of a rounded rectangle!

Jul 8, 2022
Releases(0.1.1)
Owner
Janek Zangenberg
Passionate about writing elegant code and thus creating formidable things.
Janek Zangenberg
Connect your flutter app to firebase, use firebase's Authentication. Don't mind my poor UI. 😬

flutter_email_auth A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

Syed Muhammad Ahmad 2 May 2, 2022
A dart-lang version of the SIP UA stack.

dart-sip-ua A dart-lang version of the SIP UA stack, ported from JsSIP. Overview Use pure dart-lang SIP over WebSocket (use real SIP in your flutter m

Flutter WebRTC 243 Sep 26, 2022
Extract pubspec details (such as package version, author and description) into Dart code.

build_pubspec This package helps you convert fields from your pubspec.yaml file into Dart code. Based on the fields in your pubspec, this package will

dartside.dev 9 Jul 15, 2021
Replaces Flutter's bundled Dart SDK with the macOS arm64 version

This script replaces Flutter's bundled Dart SDK with the macOS arm64 version Get

null 20 Aug 24, 2022
A mobile version of the COCO Explorer written in Dart with Flutter Framework.

COCO Explorer Mobile A mobile version of the COCO Explorer written in Dart with Flutter Framework. Cloning the repo From GitHub: Download or clone the

Mohammad Sobhy 2 May 13, 2022
Access app version and git informations from auto-generated and configurable widgets

This is a proof of concept and WIP Feedback and ideas welcome !! Access your pubspec and git commit informations like versions and commit status from

Robert Felker 15 Jul 7, 2021
A builder for extracting a package version into code

Include the version of your package in our source code. Add build_version to pubspec.yaml. Also make sure there is a version field. name: my_pkg versi

Kevin Moore 36 Sep 28, 2022
Cupertino version of the Material Stepper in Flutter

Cupertino Stepper for Flutter Cupertino version of the stock Material Stepper in Flutter. NOTE: This is not the same as the UIStepper control on iOS.

J-P Nurmi 17 Sep 13, 2022
An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

Colours An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch. Getting Started In your flut

Salman S 4 Nov 23, 2021