Skip to content

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
w2sv committed Sep 14, 2022
1 parent 2a09beb commit 6871bd0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@ Comply with data file format conventions.

# 0.0.3

Add 'toCsv' method. Improve method documentation. Remove the rather pointless 'structureInfo' method.
Add `toCsv` method. Improve method documentation. Remove the rather pointless `structureInfo` method.

# 0.1.0

- Add `shape` property, `columnIterable`, `withColumns`, `rowsAt`, `rowsWhere`
- Incorporate `Column` class being returned upon accessing a `DataFrame` column, alongside methods for
- transformation: `cumulativeSum`
- accumulation: `mean`, `max`, `min`, `sum`
- counting: `count`, `countElementOccurrencesOf`
- null-ridding: `nullFree`, `nullFreeIterable`
- mask conversion: `equals`, `unequals`, `isIn`, `isNotIn`, `maskFrom`; operators: `<`, `>`, `<=`, `>=`
- Enable conditional rows selection based on columns, e.g. `final filteredDf = df.rowsWhere((df('a') > 7) & df('b').equals(null))`
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ coverage-html:
# $$$$$$$$$ Publishing $$$$$$$$$$

pre-publish:
dart format lib
dart analyze
dart doc
dart pub publish --dry-run
@dart format lib
@dart analyze
@dart doc
@dart pub publish --dry-run

patch-version:
dart pub global activate pubversion
Expand Down
11 changes: 6 additions & 5 deletions lib/src/column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Column<E> extends ListBase<E> {
Column<E> nullFree({E? replaceWith = null}) =>
Column<E>(nullFreeIterable(replaceWith: replaceWith).toList());

/// Iterable-returning counterpart of [nullFree].
/// Iterable-returning counterpart of [nullFree].
/// Consult [nullFree] for further documentation.
Iterable<E> nullFreeIterable({E? replaceWith = null}) => replaceWith == null
? where((element) => element != null)
Expand All @@ -38,10 +38,11 @@ class Column<E> extends ListBase<E> {
/// accounted for.
///
/// Note: requires column records type to be a subtype of <num?>
List<num> cumulativeSum({bool treatNullsAsZeros = true}) => _nullFreedNums(treatNullsAsZeros: treatNullsAsZeros).fold(
[],
(sums, element) =>
sums..add(sums.isEmpty ? element : sums.last + element));
List<num> cumulativeSum({bool treatNullsAsZeros = true}) =>
_nullFreedNums(treatNullsAsZeros: treatNullsAsZeros).fold(
[],
(sums, element) =>
sums..add(sums.isEmpty ? element : sums.last + element));

// **************** accumulation ****************

Expand Down
2 changes: 1 addition & 1 deletion lib/src/dataframe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class DataFrame extends ListBase<RecordRow> {
///
/// If [start] and/or [end] are specified, the column will be sliced respectively.
Column<T> call<T>(String colName, {int start = 0, int? end}) =>
Column(columnIterable<T>(colName, start: start, end: end).toList());
Column(columnIterable<T>(colName, start: start, end: end).toList());

Iterable<T> columnIterable<T>(String colName, {int start = 0, int? end}) =>
sublist(start, end).map((row) => row[columnIndex(colName)]).cast<T>();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: koala
description: A poor man's version of a pandas Dataframe. Collect, access & manipulate related data.
repository: https://github.com/w2sv/koala
version: 0.0.3
version: 0.1.0

environment:
sdk: '>=2.13.0 <3.0.0'
Expand Down
1 change: 0 additions & 1 deletion test/src/dataframe_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ void main() {

// .columnIterable
expect(df.columnIterable('a').toList(), [43, 701, -9, -32]);
expect(df.columnIterable<double?>('a') is Iterable<double?>, true);

// .columns
expect(df.columns().toList(), [
Expand Down

0 comments on commit 6871bd0

Please sign in to comment.