Skip to content

Commit

Permalink
Merge pull request #2 from w2sv/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
w2sv authored Sep 15, 2022
2 parents eedec16 + bed8c4c commit 57007ee
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 111 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ Add `toCsv` method. Improve method documentation. Remove the rather pointless `s

# 0.1.0

- Add `shape` property, `columnIterable`, `withColumns`, `rowsAt`, `rowsWhere`
- Add `shape` property & `columnIterable`, `withColumns`, `multiIndexed`, `masked`
- 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))`
- mask conversion: `eq`, `neq`, `isIn`, `isNotIn`, `maskFrom`, `gt`, `lt`, `geq`, `leq`
- Enable conditional rows selection based on columns, e.g.
```dart
final filteredDf = df.masked(df('a').lt(7) & (df('b').eq(null) | df('c').isIn({'super', 'sick', ',', 'brother'})));
```

# 0.1.1

- Make `shape` an unmodifiable List
- Add `head` method
- Make the `start` and `end` parameters of `slice` and `sliced` keyword parameters
- Add `asView` parameter to non-constructor methods returning a `DataFrame`, to allow for determining whether a view of the current data, or a copy of it should be returned
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pre-publish:
patch-version:
dart pub global activate pubversion
pubversion patch
dart pub get

publish:
dart pub publish
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final secondRow = df[1];
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);
final filteredBColumn = df.columnAsIterable('b').where((el) => el > 7).toList();
// grab a singular record
final record = df.record<int>(3, 'b');
Expand All @@ -71,8 +71,8 @@ Copy or slice the `DataFrame`

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

Sort the `DataFrame` in-place or get a sorted copy of it
Expand Down
16 changes: 8 additions & 8 deletions lib/src/column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class Column<E> extends ListBase<E> {

// ***************** masks *******************

Mask equals(E reference) =>
Mask eq(E reference) =>
map((element) => element == reference).toList().cast<bool>();

Mask unequals(E reference) =>
Mask neq(E reference) =>
map((element) => element != reference).toList().cast<bool>();

Mask isIn(Set<E> pool) =>
Expand All @@ -86,19 +86,19 @@ class Column<E> extends ListBase<E> {
// ****************** numerical column masks *********************

/// Requires the column records type to be a subtype of num (i.e. non-null!)
Mask operator <(num reference) =>
Mask lt(num reference) =>
cast<num>().map((element) => element < reference).toList().cast<bool>();

/// Requires the column records type to be a subtype of num (i.e. non-null!)
Mask operator >(num reference) =>
cast<num>().map((element) => element > reference).toList().cast<bool>();
Mask leq(num reference) =>
cast<num>().map((element) => element <= reference).toList().cast<bool>();

/// Requires the column records type to be a subtype of num (i.e. non-null!)
Mask operator <=(num reference) =>
cast<num>().map((element) => element <= reference).toList().cast<bool>();
Mask gt(num reference) =>
cast<num>().map((element) => element > reference).toList().cast<bool>();

/// Requires the column records type to be a subtype of num (i.e. non-null!)
Mask operator >=(num reference) =>
Mask geq(num reference) =>
cast<num>().map((element) => element >= reference).toList().cast<bool>();
}

Expand Down
Loading

0 comments on commit 57007ee

Please sign in to comment.